2

I've compiled my own library file(.lib) with VS2010, but when I try to reference it like

#pragma comment(lib,"path/to/lib.lib")

I keep getting unresolved external symbols...What am I doing wrong? the #pragma comment(lib, "*.lib") worked for any library so far, and I also tried linking it under settings, no succes.

  • Use `dumpbin` on your .lib file. You can run it from a visual studio command prompt. Check that the symbols you are expecting are actually visible in the library, then report back! – Rook Jul 31 '12 at 09:35
  • to:cli_hlt yes I have, I even tried using \\ and \, even typing the path wrong(which gave me file not found) @Rook how do I use this? (actualy the first .lib I created) –  Jul 31 '12 at 09:40
  • @user1126068: either fire up a visual studio command prompt and run `dumpbin` from there, or search for it (on my machine it is in `C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\dumpbin.exe`). Now you can run something like `dumpbin /ALL mylib.lib > symbols.txt` and open up the result in a text editor and search though. – Rook Jul 31 '12 at 09:59
  • Well to run dumpbin I had to copy mspdb100.dll, then I tried running the compiler again and now I got: Program database manager mismatch; please check your installation –  Jul 31 '12 at 12:09

2 Answers2

3

1) Open a VS command console (Tools/Visual Studio Command Prompt).

2) Use cd command to change to the directory containing the library in question.

3) Enter:

dumpbin /all my_lib_name.lib > lib.txt

replacing my_lib_name.lib with the name of your library. (You'll want to write the output to a text file lib.txt for large libraries)

4) Open this newly created lib.txt to view the contents of the library. More details can be found here.

Community
  • 1
  • 1
MasterHD
  • 2,264
  • 1
  • 32
  • 41
0
  1. Open Two directories.
    • First contained library that fails
    • Second contains binary directory with compilator (For me its C:\Program Files\Microsoft Visual Studio 9.0\VC)
  2. Copy mspdb*.dll(from first directory) to directory with library
  3. Open cmd.exe in library directory
  4. Write "%FIRST_DIRECTORY/bin/dumpbin.exe" /ALL library.lib > lib.txt (For example i am writed "C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\dumpbin.exe" /ALL MyTestLibrary.lib > lib.txt)
  5. Search for methods that you want(by class name or method name)

If you dont found - developer dont writed it. OR that methods implementations are inline

If second - you should told IDE whereis source. BTW remember, no methods in library-compiling project, that accessable through user headers could be inline. All you can do to optimise speed - fastcall.

Offenso
  • 277
  • 3
  • 13