Some not very meaningful backround: I'm trying to build CGAL using Visual Studio 2010. It is dependent on GMP and MPFR libraries. I'm building my project dependent on CGAL.
When building my project, I have linker error:
error LNK1104: cannot open file 'gmp-vc100-mt-sgd.lib'
However, I told CGAL to use GMP in file gmp.lib. And it is indeed used. But somehow linker additionally wants gmp-vc100-mt-sgd.lib. So, 'gmp-vc100-mt-sgd.lib' is default name and I changed it to 'gmp.lib' by altering some CGAL configuration .h file. I've checked all possible places:
#pragma comment(lib, "gmp-vc100-mt-sgd.lib")
directives in any included .h files (I've generated .i preprocessor output for all files in my project)I've tried to rebuild CGAL and rebuild my solution with no result - linker still wants old 'gmp-vc100-mt-sgd.lib' file.
I'm stuck. Are there any other options to check? Any other sources where additional .lib dependencies come from? The only mentions of gmp-vc100-mt-sgd.lib are in CGAL .lib and .obj files under /DEFAULTLIB: directive. I searched through all files in CGAL solution to find mention of this magic gmp-vc100-mt-sgd.lib name with no result.
I checked every #pragma directive in .i file to ensure name gmp-vc100-mt-sgd.lib is not split in parts so I cannot find it. It's absolutely not presented there.
Any ideas?
Ok, I figured it out. The problem really was in this /DEFAULTLIB I found inside CGAL.lib file.
It turned out, when Visual Studio is building .lib file and encounters #pragma comment
directive it leaves some instructions how to link this library. As I understand, it just tells the linker to use /DEFAULTLIB option when linking with it. And then linker tries to add this library in search list, even if it has no unresolved externals.
So I was trying to remove #pragma comment
directive when building my project, but I should have tried to remove it when building CGAL project itself. The latter works fine.