连接错误error LNK2019,请大侠指正
使用VS2010建的空项目,然后编写主函数和调用函数
主函数:
#include <iostream>
#include "../../global/descriptor.h"
int main()
{
std::cout << codeinfo(2) << std::endl;
system("pause");
return 0;
}// 主函数完成;
调用函数头文件;
descriptor.h
extern const char * const codeinfo(int info_code);
调用函数CPP
const char * const codeinfo(int info_code)
{
return (*addr[type])[code];
}
编译成功,连接失败,提示如下:
1>main.obj : error LNK2019: unresolved external symbol "char const * __cdecl codeinfo(int)" (?codeinfo@@YAQBDH@Z) referenced in function _main
1>H:\my_program_life\HUXUEFENG\MAIN\Debug\test_string_capacity.exe : fatal error LNK1120: 1 unresolved externals
其中main.cpp和descriptor.h及descriptor.cpp不在同一目录
目录树如下:
_use_case
| |___test
| |__main.cpp
|
|_global
|___descriptor.h
|___descriptor.cpp
其中use_case和global属于同级目录
test是use_case下的子目录,其中包含main.cpp主函数
global没有子目录,直接包含descriptor.h和descriptor.cpp
小弟无解,请大侠指正;万分感激;