分类:
2008-09-17 11:11:52
()
- ()
-- ()
[求助] vc6下一个LNK2001错误求助
代码很简单,就是一个模板使用的程序。
#include
template
{
return( (a>b)?a:b );
}
float compare_values(float a,float b);
int compare_values(int a ,int b);
long compare_values(long a , long b);
void main(void)
{
float a=1.23,b=2.34;
int c=1,d=2;
long e=1001101L,f=2020202L;
cout <<"Comparing "<
cout <<"Comparing "<
提示错误:
exam1.obj: error LNK2001:unresolved external symbol "long __cdecl compare_values(long,long)" (?compare_values@@YAJJJ@Z)
exam1.obj: error LNK2001:unresolved external symbol "int __cdecl compare_values(int,int)" (?compare_values@@YAHHH@Z)
exam1.obj: error LNK2001:unresolved external symbol "float __cdecl compare_values(float,float)" (?compare_values@@YAMMM@Z)
Debug/exam.exe: fatal error LNK1120: 3 unresolved externals
不单是这个代码,写其他一些看起来没错误的代码时,也会出现这类错误--"error LNK2001:unresolved external symbol "****" (?***@@***@Z)",因为这个函数的声明和定义都很清楚地写着,按说没什么错的地方,所以我想是否会是vc的什么地方设置错误,请教各位有没有建议?多谢多谢!
我用的是visual c++6.0英文版,用的是安装时的默认设置。
画蛇添足了
#include
template
T compare_values(T a, T b)
{
return( (a>b)?a:b );
}
// float compare_values(float a,float b);
// int compare_values(int a ,int b);
// long compare_values(long a , long b);
void main(void)
{
float a=1.23,b=2.34;
int c=1,d=2;
long e=1001101L,f=2020202L;
cout <<"Comparing "<
cout <<"Comparing "<
多谢。
全部时间均为北京时间. 现在时间是14:38 . |
Powered by: vBulletin Version 2.2.8
Translated and hacked by:
Copyright © Jelsoft Enterprises Limited 2000, 2001.