Linking a .lib file on Windows 7

前端 未结 2 1796
半阙折子戏
半阙折子戏 2021-01-20 10:18

I have a C++ program test.cpp and I want to link two .lib files to it(fhlib.lib and gc_lib.lib).I have the .lib files in the same folder as my .cpp program. I\'m on Windows

相关标签:
2条回答
  • 2021-01-20 11:08

    If you're compiling with g++ on windows, I guess you're using MinGW: MinGW relies on .a libraries. When using the "-l" option, the compiler is looking for a library file with the extension .a.

    Libraries in the format .lib are compiled with visual studio: you can't use it as this. Compile your libraries with MinGW if you have the sources or consider migrating your project to visual studio.

    0 讨论(0)
  • 2021-01-20 11:09

    So the problem was that the lib files where compiled in VS. And I had to use the VS compiler instead of g++ and everything worked fine.

    0 讨论(0)
提交回复
热议问题