VS release mode error LNK2038

The engine.
Post Reply
wjaeger
Posts: 7
Joined: Thu Aug 13, 2015 10:50 am

VS release mode error LNK2038

Post by wjaeger »

Hi,

I'm getting a bunch of LNK2038 error messages when running SMILE in release mode in visual studio 2010, e.g.

Code: Select all

smile_dbg.lib(doublearray.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in CreateNetwork.obj
Could you help with that?

In debug mode I have no problems. In project settings the preprocessor definitions are set to _SECURE_SCL=0 (even though omitting it doesn't seem to make a difference) and Additional Include Directories as well as Additional Library Directories are set to mydirectory smile_vc10_x86/.

Thank you in advance for your help!

Wiebke
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: VS release mode error LNK2038

Post by shooltz[BayesFusion] »

smile_dbg.lib(doublearray.obj) : error LNK2038
You're linking with smile_dbg.lib, which is for debug builds. Did you use autolinking feature in smile.h, or specified the library in linker settings?
wjaeger
Posts: 7
Joined: Thu Aug 13, 2015 10:50 am

Re: VS release mode error LNK2038

Post by wjaeger »

Thanks for the fast response!

I don't have any additional dependencies under linker -> input. So I suppose I rely on the auto-linking feature of smile.h (Is that what it means?).

If I remove the path to smile_vc10_x86 in additional library directories, I get the same error in Release mode and I get error LNK1104: cannot open file 'smile_dbg.lib' in Debug mode.
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: VS release mode error LNK2038

Post by shooltz[BayesFusion] »

Including smile.h ensures that proper smile library is used (via #pragma comment directives). The message explictly states that smile_dbg.lib is being used, so I suppose in release mode you have both smile.lib and smile_dbg.lib referenced, the former from smile.h, the latter manually added somewhere.

I'd try to look at the 'Command line' under Linker|Advanced in the project settings. Can you post it here?
wjaeger
Posts: 7
Joined: Thu Aug 13, 2015 10:50 am

Re: VS release mode error LNK2038

Post by wjaeger »

Under Linker|Command line it has the following:

/OUT:"C:\Users\localadmin\documents\visual studio 2010\Projects\BNAdaptorTEST_WIN\Release\BNAdaptorTEST_WIN.exe" /NOLOGO /LIBPATH:"D:\wjaeger\smile_vc10_x86" /LIBPATH:"D:\wjaeger\boost_1_59_0\stage\lib" /LIBPATH:"C:\Program Files (x86)\netCDF 4.3.3.1\bin" /LIBPATH:"C:\Program Files (x86)\netCDF 4.3.3.1\lib" "C:\Program Files (x86)\netCDF 4.3.3.1\lib\netcdf.lib" /MANIFEST /ManifestFile:"Release\BNAdaptorTEST_WIN.exe.intermediate.manifest" /ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Users\localadmin\documents\visual studio 2010\Projects\BNAdaptorTEST_WIN\Release\BNAdaptorTEST_WIN.pdb" /OPT:REF /OPT:ICF /PGD:"C:\Users\localadmin\documents\visual studio 2010\Projects\BNAdaptorTEST_WIN\Release\BNAdaptorTEST_WIN.pgd" /LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:QUEUE
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: VS release mode error LNK2038

Post by shooltz[BayesFusion] »

Under Linker|Command line it has the following:
There are no direct references to SMILE in the command line (which is OK). Can you set the 'Show Progress' to 'For libraries searched' in Linker|General? This will display the libraries linker is looking for during the build.
wjaeger
Posts: 7
Joined: Thu Aug 13, 2015 10:50 am

Re: VS release mode error LNK2038

Post by wjaeger »

In this case it still shows:

/OUT:"C:\Users\localadmin\documents\visual studio 2010\Projects\BNAdaptorTEST_WIN\Release\BNAdaptorTEST_WIN.exe" /VERBOSE:Lib /NOLOGO /LIBPATH:"D:\wjaeger\smile_vc10_x86" /LIBPATH:"D:\wjaeger\boost_1_59_0\stage\lib" /LIBPATH:"C:\Program Files (x86)\netCDF 4.3.3.1\bin" /LIBPATH:"C:\Program Files (x86)\netCDF 4.3.3.1\lib" "C:\Program Files (x86)\netCDF 4.3.3.1\lib\netcdf.lib" /MANIFEST /ManifestFile:"Release\BNAdaptorTEST_WIN.exe.intermediate.manifest" /ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Users\localadmin\documents\visual studio 2010\Projects\BNAdaptorTEST_WIN\Release\BNAdaptorTEST_WIN.pdb" /OPT:REF /OPT:ICF /PGD:"C:\Users\localadmin\documents\visual studio 2010\Projects\BNAdaptorTEST_WIN\Release\BNAdaptorTEST_WIN.pgd" /LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:QUEUE
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: VS release mode error LNK2038

Post by shooltz[BayesFusion] »

The option you've added will have an effect during build - you should see the list of libraries needed by linker to create your executable.
Post Reply