dimanche 13 novembre 2016

Can't find symbol but I seem to be linking to library containing symbol

I have compiled Google test to produce the debug library gtestd.lib using Visual Studio 2015. The dumpbin /SYMBOLS of the file gives the following line:

6AC8 00000000 SECT1306 notype ()    External   | ?InitGoogleTest@testing@@YAXPAHPAPAD@Z (void __cdecl testing::InitGoogleTest(int *,char * *))

When I compile I get the following error:

Error   LNK2001 unresolved external symbol "void __cdecl testing::InitGoogleTest(int *,char * *)" (?InitGoogleTest@testing@@YAXPAHPAPAD@Z)  test_mpeg   C:\Users\James\Documents\Git\mpeg_ts_messing\gtest\vs_express_2015\gtest_binary_buffer.obj  1   

The compiler is looking for ?InitGoogleTest@testing@@YAXPAHPAPAD@Z and the .lib contains ?InitGoogleTest@testing@@YAXPAHPAPAD@Z. Both identical names. Both __cdecl with same function signature and the .lib symbol is visible externally.

I have linked my project against gtestd.lib:

/OUT:"C:\Users\James\Documents\Git\mpeg_ts_messing\gtest\vs_express_2015\Debug\test_mpeg.exe" 
/MANIFEST 
/NXCOMPAT
/PDB:"C:\Users\James\Documents\Git\mpeg_ts_messing\gtest\vs_express_2015\Debug\test_mpeg.pdb" 
/DYNAMICBASE "gtestd.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG:FASTLINK     /MACHINE:X86 /INCREMENTAL 
/PGD:"C:\Users\James\Documents\Git\mpeg_ts_messing\gtest\vs_express_2015\Debug\test_mpeg.pgd" 
/MANIFESTUAC:"level='asInvoker' uiAccess='false'" 
/ManifestFile:"Debug\test_mpeg.exe.intermediate.manifest" /ERRORREPORT:PROMPT 
/NOLOGO 
/LIBPATH:"C:\Users\James\Documents\Git\mpeg_ts_messing\gtest\vs_express_2015\..\gtest\libs\Debug" /TLBID:1 

The /LIBPATH points to the correct directory and gtestd.lib is in the /DYNAMICBASE.

So... I'm a little stumped as to why the linker can't find the symbol, and how to debug this further. Anyone with any clues?

Aucun commentaire:

Enregistrer un commentaire