Perry
Perry

Reputation: 41

MSVC - C++ - Release build failed - linker error

HI,

If I am trying to build and link my app in Release mode, i got linker error:

Error 72 error LNK2001: unresolved external symbol "public: __thiscall MyModels::MT6::MT6(double)" (??0MT6@MyModels@@QAE@N@Z) C:\Martin\Programing\WoknaTest\WoknaTest\DXForm.obj WoknaTest

In debug mode everything works fine.... what could be possibly wrong ?

Thanks

Upvotes: 2

Views: 4865

Answers (4)

VHanded
VHanded

Reputation: 2089

For me, it is always a this 2 solutions:

  1. Project Properties > Configuration Properties > Linker > General, Link Library Dependencies = Yes
  2. Project Properties > Configuration Properties > Linker > Input, Additional Dependencies, Edit. Check ‘Inherit from parent or project defaults’

Upvotes: 0

Corvin
Corvin

Reputation: 990

Most likely version (provided that you didn't manually edit your project settings) is that there is some library referenced by your code and you don't have the release version of your library. Typically, the linker references libraries with "d" suffix for debug and without it for release.

For example: you have a project VectorMath in your solution. The project by default builds a library vectormathd.lib in debug config and vectormath.lib in release. If your dependencies are screwed up and you have never build a release version of vectormath, you'll build your main project in release and it will be looking for vectormath.lib, which you won't have - hence the unresolved external symbol. The solution would be to make sure that all projects are built in release mode, or fix the dependencies to have the VS do that for you.

Upvotes: 1

user530189
user530189

Reputation:

Judging from the fact that it builds successfully in the debug configuration, my first suggestion would be to check the additional dependencies supplied to the linker. This setting would be Additional Dependencies setting under Project -> Properties -> Configuration Properties -> Linker -> Input. Make sure this setting matches what is under the debug configuration, assuming there aren't debug-build-specific library names.

Upvotes: 6

NotJarvis
NotJarvis

Reputation: 1247

I'd check in the Project settings that all the .lib includes and dlls are included in both Release and Debug modes.

The solution to this is probably in the project settings for linking somewhere (either .lib .dll or path includes) , but I can't really tell you exactly where from the info. you provided.

Upvotes: 2

Related Questions