开发者

C++ unresolved externals [duplicate]

This question already has answers here: What is an undefined reference/unresolved external symbol error and how do I fix it? (39 answers) Closed 3 years ago.

Does anyone know what this means?

1>  Generating Code...
1>BlankWindowDXbaseImpl.obj : error LNK2019: unresolved external symbol "public: __thiscall DXBase::DXBase(void)" (??0DXBase@@QAE@XZ) referenced in function "public: __thiscall BlankWindowDXBaseImpl::BlankWindowDXBaseImpl(void)" (??0BlankWindowDXBaseImpl@@QAE@XZ)
1>BlankWindowDXbaseImpl.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall DXBase::~DXBase(void)" (??1DXBase@@UAE@XZ) referenced in function "public: virtual __thiscall开发者_如何学Go BlankWindowDXBaseImpl::~BlankWindowDXBaseImpl(void)" (??1BlankWindowDXBaseImpl@@UAE@XZ)
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall DXBase::shutdown(void)" (?shutdown@DXBase@@QAEXXZ) referenced in function _wWinMain@16
1>main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall DXBase::initalize(struct HINSTANCE__ *,struct HWND__ *)" (?initalize@DXBase@@QAE_NPAUHINSTANCE__@@PAUHWND__@@@Z) referenced in function _wWinMain@16
1>C:\backup\development\directXworkspace\BlankWindow\Debug\BlankWindow.exe : fatal error LNK1120: 4 unresolved externals


It means that you have unresolved external symbols.

What are symbols? Symbols can be anything from variables, classes, member functions or functions.

Why they are unresolved? Some part of your code (or libraries that you are using) rely on these symbols and they are not being found because you are not linking the correct library or implementing them.


Yes, it means your program calls functions that are declared but have no body.

Are you expecting these functions to be part of your code, or provided by some library?


It means you have a linker problem. (The linker can't find a library with those symbols) You need to include the required library in your library path.


probably you are not linking against proper library.

But you should give some more details.. it looks like you are asking question in a quiz contest.


I just had the same issue and if you add the #pragma comment(lib,"d3d9.lib") This will include the library files necessary to compile your code. It is just getting confused which lib file to grab either the 64 or 32 bit. Hope this helps.


I'm sharing a just faced issue that was difficult to detect: if you are linking to two libs (a.lib and b.lib) located in different lib paths ( /PathToA/ and /PathToB/ ), the problem of unresolved externals may arise if there is an old version of, let's say b.lib in the path /PathToA/.

In this case, you may incorrectly link to an unwanted lib. So as a solution for this particular multi-linking problem, be sure that you do not have several versions of a library in your library paths.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜