如何在vc 6.0中解决此错误? [英] How to resolve this error in vc 6.0?
问题描述
我遇到以下错误.如何纠正此错误?
错误LNK2001:无法解析的外部符号"int __cdecl ScrambledActName(char *)"(?ScrambledActName @@ YAHPAD @ Z)
I am getting the following error.. How to rectify this error?
error LNK2001: unresolved external symbol "int __cdecl ScrambledActName(char *)" (?ScrambledActName@@YAHPAD@Z)
推荐答案
链接器找不到函数使用具有以下类型的C ++编译器进行编译:
The linker can''t find a function compiled with a C++ compiler with the protype:
int ScrambledActName(char *);
您代码中的任何位置,或您要链接的库.
在我的头顶上,有几个原因可能会导致错误...
-您尚未实现该功能-请去编写它!
-有人为您提供了一个库,但没有提供工作所需的所有依赖项
-有人编写了该函数,但使用C编译器而不是C ++编译器进行了编译.解决这一问题的方法是找到函数在代码中的原型,并在其外部加上"C"前缀,以告知编译器它是使用C编译器编译的函数:
anywhere in your code, or the libraries you''re linking with.
Of the top of my head there are several reasons this might go wrong...
- You didn''t implement the function - go and write it!
- Someone else supplied you a library but didn''t give you all the dependencies it needed to work
- Someone wrote the function but compiled it with a C compiler, not a C++ one. The way around this one is to find where the function is prototyped in your code and preface it with extern "C" to tell the compiler it''s a function compiled with a C compiler:
extern "C" int ScrambledActName( char * );
-该函数在某处的原型不正确.例如,原始程序员可能已经使用const参数对其进行了原型设计.
不知不觉就很难再发表评论了.
干杯,
灰
- The function was prototyped incorrectly somewhere. The original programmer might have prototyped it with a const parameter for example.
Without knowing any more it''s a bit hard to comment any further.
Cheers,
Ash
这篇关于如何在vc 6.0中解决此错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!