1

I am aware of How to link using an external pdb?, but the accepted answer to this question doesn't really give me any useful information.

I have pre-compiled FLTK into a collection of static .lib library files, so that it can be used by any number of projects in my repository. I'm currently attempting to use it in a project that is compiled for Windows, with the MSVC compiler, on the command line (so no Visual Studio project settings to tweak).

The project compile and runs fine, but I'd like to get rid of the warnings that are emitted on linking:

fltkd.lib(scandir.obj) : warning LNK4099: PDB 'fltk.pdb' was not found with 'fltkd.lib(scandir.obj)' or at 'C:\my_executable_path\fltk.pdb'; linking object as if no debug info

Basically, all I want to be able to do is point the linker at the folder where fltk.pdb lives. I currently have this in the same folder as fltk.lib and assumed that the linker would find it when it picked up the library, but it does not. I'd like to avoid copying the .pdb to the output directory of the executable if possible, because it'll make my build scripts more complicated - I'd like to just let the compile tools handle what ends up in the build output folder.

Is there any way I can provide the path to the linker? I've tried the /PDBALTPATH option but it didn't work; I think this might be used for creating the original .pdb rather than referencing an existing one. I've also had a look at verbose linking, but this just seems to spam me with messages about where the symbols themselves live, and doesn't give any information about how the .pdb file is used.

EDIT: For more information, I'm using Visual Studio Community 2017 (and the command-line compiler tools that come with it, where appropriate). I built FLTK for x64 by using the Visual Studio Configuration Manager to create a new solution platform (x64) from an existing one (Win32). The compile settings for FLTK are as follows:

/FR"x64\Debug\" /GS /W1 /Zc:wchar_t /I"." /I"..\..\zlib" /I"..\..\png"
/I"..\..\jpeg" /I"../.." /Zi /Gm- /Od /Fd"x64\Debug\fltk.pdb" /Zc:inline
/fp:precise /D "_CRT_SECURE_NO_DEPRECATE" /D "FL_LIBRARY" /D "WIN32"
/D "_DEBUG" /D "_WINDOWS" /D "WIN32_LEAN_AND_MEAN" /D "VC_EXTRA_LEAN"
/D "WIN32_EXTRA_LEAN" /D "_VC80_UPGRADE=0x0710" /errorReport:prompt
/WX- /Zc:forScope /Gd /MDd /FC /Fa"x64\Debug\" /EHsc /nologo
/Fo"x64\Debug\" /Fp"x64\Debug\fltkd.pch" /diagnostics:classic

And the link settings are:

/OUT:"..\..\lib\fltkd.lib" /MACHINE:X64 /NOLOGO

This does indeed generate an fltk.pdb within x64\Debug, along with .pdb files for the handful of dependent projects (PNG, JPEG, ZLIB, fltkdlld). It should probably be noted that, if I compile all the other sample applications that come with FLTK, they give PDB linking warnings as well, but only under x64.

I copied all the .libs to a separate folder for use with my C++ project, which uses the Waf build system. To build the project I'm using the compile flags:

/MDd /EHsc /ZI /FS

And for linking:

/DEBUG:FASTLINK
/MACHINE:X64

The lib paths (discovered by Waf at configuration time) are passed as well, and the .pdb file exists in the same directory as the .lib file.

NoodleCollie
  • 855
  • 7
  • 24
  • 1
    I think the pdb file has a timestamp inside that must match the timestamp of the library. Did you check that the `.pdb` has been created in the same run as the `.lib` had? You could e.g. compare the file modification times. – harper Mar 26 '19 at 12:57
  • I think this is an interesting question. So I would like to reproduce the problem although I don't have the mentioned libraries. I also don't have a project that uses it. I would use any library from my environment for reproduction of the case. But it would be necessary that you provide all linker command line options that are related to that library as well as the version of the tools you use. – harper Mar 26 '19 at 13:00
  • I've updated with more information about the compile settings. – NoodleCollie Mar 26 '19 at 15:40

0 Answers0