Kiril
Kiril

Reputation: 40345

Switched from Visual Studio 2008 to Visual Studio 2010 and unable to link to boost filesystem now

I just switched from Visual Studio 2008 to Visual Studio 2010 and one of my projects is now getting a linker error:

LINK: fatal error LNK1104: cannot open file 'libboost_filesystem-vc90-mt-gd-1_46_1.lib'

I did rebuild boost and I see the vc10 libraries in the lib folder, but I can't figure out why/how it's still referencing the vc90 libraries? I checked the linker properties and I'm pointing to the correct folder (i.e. to the folder of the vc10 libraries). In the input section I'm not specifying the library, so I don't know how it got the reference to the vc90 lib.

Does anybody know what's the solution to this issue?

Update

The build command that I used to build boost is:

bjam --build-dir=c:\boost --build-type=complete --with-filesystem --toolset=msvc address-model=64 stage

It automatically resulted in the following output (amongst other things):

stage\lib\boost_filesystem-vc100-mt-1_46_1.lib

Command Line

Linker:

/OUT:"bin\x64\Debug\NEST2.dll" /INCREMENTAL /NOLOGO /LIBPATH:"C:\Users\USER\Desktop\sandbox\boost_1_46_1\bin\x64\lib" /LIBPATH:"C:\Users\USER\Desktop\sandbox\db-5.1.25\build_windows\x64\Release" /DLL "ws2_32.lib" "advapi32.lib" "libdb51.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /MANIFEST /ManifestFile:"tmp\x64\Debug\NEST2.dll.intermediate.manifest" /ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\dev\app\NEST2\bin\x64\Debug\NEST2.pdb" /ASSEMBLYDEBUG /SUBSYSTEM:WINDOWS /PGD:"C:\dev\app\NEST2\bin\x64\Debug\NEST2.pgd" /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X64 /ERRORREPORT:QUEUE

Compiler:

/I"C:\Users\USER\Desktop\sandbox\boost_1_46_1" /I"C:\Users\USER\Desktop\sandbox\db-5.1.25\build_windows" /Zi /nologo /W3 /WX- /Od /Ot /D "WIN32" /D "_WIN64" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "NEST2_EXPORTS" /D "_HAS_ITERATOR_DEBUGGING=0" /D "__SECURE _SCL=0" /D "_WINDLL" /D "_UNICODE" /D "UNICODE" /Gm- /EHsc /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fp"tmp\x64\Debug\NEST2.pch" /Fa"tmp\x64\Debug\" /Fo"tmp\x64\Debug\" /Fd"tmp\x64\Debug\vc100.pdb" /Gd /errorReport:queue

Update 2.0

1>------ Build started: Project: NEST2, Configuration: Debug x64 ------
1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1200,9): warning : The referenced project '{FD045D60-ABAD-4A6C-9794-9BFB085FC3E7}' does not exist.
1>  
1>  Starting pass 1
1>  Processed /DEFAULTLIB:msvcprtd
1>  Processed /DEFAULTLIB:MSVCRTD
1>  Processed /DEFAULTLIB:OLDNAMES
1>  Processed /DEFAULTLIB:libboost_filesystem-vc90-mt-gd-1_46_1.lib // <--- Here it is
1>  Processed /DEFAULTLIB:libboost_system-vc90-mt-gd-1_46_1.lib // <--- and here!
1>  Processed /DEFAULTLIB:uuid.lib

Now if I could only figure out why it's referencing the wrong library!

Upvotes: 2

Views: 3160

Answers (2)

Kiril
Kiril

Reputation: 40345

After I updated to Visual Studio 2010 Service Pack 1 the linker issues went away. BUilding boost with the msvc flag or the msvc-10.0 flag resulted in the same output, so that had no effect on the issue.

Additionally, I had to remove the _ITERATOR_DEBUG_LEVEL macro because it was causing a mismatch when linking (Linker Error LNK2038).

I'm not sure why it wouldn't link properly until SP1 was installed, so if somebody has an idea, then please post it.

Upvotes: 2

fileoffset
fileoffset

Reputation: 976

Check your C++ Linker Command Line and make sure it doesn't reference the vc90 libraries. If it is you may have manually added the lib dependency to your 'additional libraries' section.

If you are still unable to fix it, paste both the Compiling and Linking Command Line's here.

Upvotes: 1

Related Questions