开发者

C++ linker unresolved external symbol (again;) from other source file *.obj file. (VC++ express)

I'm back to C/C++ after some break. I've a following problem:

I've a solution where I've several projects (compilable and linkable). Now I need to add another project to this solution which depends on some sources from other projects.

My new project compiles without any problems (I've added "existing sources" to my project).

the error:

1>Linking...
1>LicenceManager.obj : error LNK2019: unresolved external symbol "int __cdecl saveLic(char *,struct Auth *)" (?saveLic@@YAHPADPAUAuth@@@Z) referenced in function "public: void __thiscall LicenceManager::generateLicence(int,char *)" (?generateLicence@LicenceManager@@QAEXHPAD@Z)
1>LicenceManager.obj : error LNK2019: unresolved external symbol "void __cdecl getSysInfo(struct Auth *)" (?getSysInfo@@YAXPAUAuth@@@Z) referenced in function "public: void __thiscall LicenceManager::generateLicence(int,char *)" (?generateLicence@LicenceManager@@QAEXHPAD@Z)

Functions saveLic, and getSysInfo are defined in files which I've added to my new project from existing ones. There is object file created during compilation with those functions in target dir, but my LicenceManager class doesn't want to link.

I use some

extern "C" , and #pragma pack

somewhere, but no more fancy stuff. I think every directory, lib and other necessary dependencies are visible in settings for this project.

Thanks for 开发者_Python百科any advice.


Seems like you need to make sure the functions are declared properly as C functions:

#ifdef __cplusplus
extern "C" {
#endif

int saveLic(char *,struct Auth *);
void getSysInfo(struct Auth *);

#ifdef __cplusplus
}
#endif

In a header file included by LicenceManager.cpp.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜