LNK4099 in GLFW console project with debug configu

2019-08-07 14:05发布

When compiling a win32 console project with GLFW in Visual Studio 2010 SP1, I am getting the following warning for debug configuration:

Warnung 1   warning LNK4099: PDB "vc100.pdb" wurde nicht mit "GLFW.lib(enable.obj)" oder an "C:\path-to-project with-spaces\World\Debug\vc100.pdb" gefunden; Objekt wird verknüpft, als ob keine Debuginformationen vorhanden wären.    C:\path-to-project with-spaces\World\World\GLFW.lib(enable.obj) World

13 more for GLFW.lib(enable.obj), GLFW.lib(glext.obj), GLFW.lib(image.obj), GLFW.lib(init.obj), GLFW.lib(input.obj), GLFW.lib(stream.obj), GLFW.lib(tga.obj), GLFW.lib(win32_enable.obj), GLFW.lib(win32_fullscreen.obj), GLFW.lib(win32_glext.obj), GLFW.lib(win32_init.obj), GLFW.lib(win32_time.obj), GLFW.lib(win32_window.obj), GLFW.lib(window.obj)

And last but not least:

Fehler  15  error LNK1104: Datei "C:\path-to-project with-spaces\World\Debug\World.exe" kann nicht geöffnet werden. C:\path-to-project with-spaces\World\World\LINK World

The release configuration is compiling. This is probably still not enough information for solving my problem, but I would appreciate an explanation for why this can happen.

3条回答
姐就是有狂的资本
2楼-- · 2019-08-07 14:25

Whenever building a project with VC++ fails, it's best to consult the MSDN with the error code. In your case http://msdn.microsoft.com/en-en/library/b7whw3f3(v=vs.80).aspx

Linker Tools Warning LNK4099 PDB 'filename' was not found with 'object/library' or at 'path'; linking object as if no debug info The linker was unable to find your .pdb file. Copy it into the directory that contains object/library.

To find the name of the .pdb file associated with the object file:

  1. Extract an object file from the library with lib /extract:objectname.obj xyz.lib.

  2. Check the path to the .pdb file with dumpbin /section:.debug$T /rawdata objectname.obj.

You could also compile with /Z7, so the pdb doesn't need to be used, or remove the /DEBUG linker option if you do not have .pdb files for the objects you are linking.

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-08-07 14:33

I don't know what the warnings/errors are saying because I don't know any German whatsoever, but generally if something compiles/links for release but not debug (or vice-versa) this means you're linking to the wrong libraries for the one that isn't working. Are there specific debug libraries (.dll's or .lib's) for the GLFW library? Sometimes you have to tell VS to use one for your project's release configuration and a different one for your project's debug configuration. Check for something like glfw.lib and glfw_d.lib, where the _d would indicate the debug library.

Or if you could supply the English translation of the link warnings/errors I might be able to help more.

Good luck!

查看更多
Deceive 欺骗
4楼-- · 2019-08-07 14:38

I was already using the right lib for debug configuration but was not only linking to GLFW.lib but also to GLFWDLL.lib. You can either compile GLFW into you executeable by using GLFW.lib or use a DLL by linking to GLFWDLL.lib. I accidentally did both.

Additional info at

4.2 Link with the right libraries

in the current GLFW 2.7 Release Notes.

查看更多
登录 后发表回答