How to solve "cannot open file 'LIBCD.lib' " in visual studio 2008? - c++

trying to compile some code i downloaded, i get link error LNK1104: cannot open file 'LIBCD.lib'. i cant find this file anywhere on my computer. what is it, and can i download it from somewhere? is there another way to get the code to work?

In my case, I only wrote "LIBCD.lib" in Configuration Properties -> Linker -> Input -> Ignore Specific Library

The first hit on Google for libcd says:
This file is the static library for the debug single threaded version
of the C runtime. Visual Studio 2005 no longer supports this version
of the C runtime: instead you need to use the multi-threaded version
(libcmtd.lib) or the dynamically linked (DLL) version (msvcrtd.lib).
To fix this problem you will need to change the makefile that comes
with GLUI to get it to use a different version of the library.
and some other things that might help you.

You can fix this from the project settings. You need to add the /NODEFAULTLIB to the linker settings:
core.2f.nodefaultlib.asp">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/core.2f.nodefaultlib.asp
This option will make the linker ignore all the /DEFAULTLIB directives - this will remove the dependency on libcd.lib. Unfortunately it will remove all the other dependencies as well so you will need to explicitly add the libraries you do need (like glut32.lib etc.) as inputs to the linker.

Related

Error linking libboost_system in Visual C++

I have a problem using boost.asio. I use Windows XP and Visual Studio 2005
I followed these steps:
I downloaded the latest version (http://sourceforge.net/projects/boost/files/boost/1.46.1/) of W: \boost_1_46_1
I set the environment variable INCLUDE : W:\boost_1_46_1
In the properties of my project (VS->tools->Options project&solutions->vcc++directories) I added $(INCLUDE)
I added in my file. h this:
I get the following error:
LINK : fatal error LNK1104: cannot open file 'libboost_system-vc80-mt-gd-1_46_1.lib
This is a linker error. Find the lib, and go to linker input, and add it there. Be sure to set the libpath as well. This picture should guide you:
The boost::asio library needs to be built. ( Many other boost 'libraries are headers only and do not need to be built ). Building it yourself is a small challenge. Better to use the pre-built binary installer which is here
Once you have the built libraries, one way or another, you have to tell the linker where they are. However, you do not need to specify each individual library by name, just specify the folder that contains them. The easiest way to do this IMHO is to create an environment variable called BOOSTROOT which you you set equal to the folder where you installed boost. Then you tell the linker to look for libraries in $(BOOSTROOT)/lib

Visual Studio linker cannot find libboost_system

I'm using VS 2008 and want to use the boost::asio library.
I could get this to work in a new project (I want to include boost/bind.hpp and boost/asio.hpp), but in an existing project I get this error:
fatal error LNK1104: Datei "libboost_system-vc90-mt-sgd-1_46.lib" cannot be found.
I can't find this file in the boost directory, but this one: libboost_system-vc90-mt-gd-1_46.lib (gd instead of sgd) What could that mean?
Thank you!
I assume you've used the Boost installer from BoostPro. If so reinstall it and make sure you select Multithread Debug, static runtime.
Boost names its libraries based on what options were used in compiling them. "mt," for instance, means "multi-threaded runtime"; and I'm sure you can figure out what "vc90" means (compared to, say, "gcc4"). I think the "s" means "static."
Your solution is to first make sure you're using the same options that were used in building the library, and then change the name of the file you're linking against in the project options.
It means you have to go to the project properties and change the name of the boost library that is currently included for linking. If you have libboost_system-vc90-mt-gd-1_46.lib, you should use it.
Configuration Properties => Linker => Input => Additional dependencies

ODBC refuses to statically link to libcmt.lib under VS2010

There is a short response from Microsoft regarding this issue:
https://connect.microsoft.com/VisualStudio/feedback/details/470376/odbc-application-linking-with-odbccp32-lib-gets-link-errors-in-vs2010-beta-1?wa=wsignin1.0#tabs
Basically, their response doesn't seem to address the problem.
Our application needs to statically link to the C libraries, but there is a linker error when attempting to do so. Microsoft's answer seems to be "dynamically link instead", but that's not an option. Their alternative is to "Use the version of odbccp32.lib that came with Vista SDK." However, I am unaware as to how to force VisualStudio 2010 to use a different version of the ODBC library?
I just spent the last hour trying every conceivable search through the .vcxproj and .sln files for any references to odbccp32.lib. None. I similarly looked for ODBC. None. Looking at all of the compiler & linker options for the project(s) in question: nothing refers to ODBC whatsoever. The only connection between our application and ODBC I can see is the #include <sql.h> and <sqlext.h>. However, even those files do not refer to odbccp32.lib (or any other .lib or linker option).
The only references to odbccp32.lib I can find at all are in .obj files. So it appears that VS2010 automagically knows which ODBC libraries to link against based on what functions are referenced in our software (SQLConnect(), for example).
So how might I:
1) "obtain Vista SDK version of odbccp32.lib"?
2) cause VS2010 to link against that version?
-OR-
Is there a better way to solve this?! Right now I am unable to proceed with a conversion of our software from VS2008 -> 2010 unless I can find a way to force this goofy software to compile.
NOTE: Apparently I could force the system to compile using 2008's tooling, which may "cure" this. But that means changing all of our projects up & down the chain to do this, which is rather backwards and contrary to the whole point of moving to 2010, no?
For the curious, the exact linker error:
odbccp32.lib(dllload.obj) : error LNK2019: unresolved external symbol __imp___vsnprintf referenced in function _StringVPrintfWorkerA#20
Reading through your link, it seems that Microsoft has verified that there is a problem, and they intend to fix it in the next version of the SDK. Doesn't help much, does it?
It's quite normal for the linker to daisy-chain through the objects, linking one object only to discover that it has dependencies on other objects. If you want to preemptively link to a specific library, add it to the "Additional Dependencies" in the Linker Input tab of the project properties.
If you aren't able to get the linker to prefer a specific version of a library, just seek out and replace the version of the library in the installation.
I think this is a link to the Vista SDK, but I can't verify it: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=ff6467e6-5bba-4bf5-b562-9199be864d29&displaylang=en
I see it. Ouch, my condolences. Their advice is about as best as it is going to get if you don't want to compile with /MD. I think I know the source of the problem, this isn't that easy to fix for them either. It's going to require them getting the VS2010 CRT header file fixed first, then recompile and issue an SDK update. That takes some major doing.
It is getting linked because it is listed in the "Core Windows Libraries" property sheet. View + Property Manager to see it. Not linking it is not an option, you are probably actually using it when you #include <sql.h>
The Vista version indeed doesn't have the same problem, it was probably built with an earlier version of VS. Project + Properties, Linker, Input, Additional Dependencies = "c:\program files\microsoft sdks\windows\v6.0a\lib\odbccp32.lib". This injects the vista version before the 7.0 version. You may have to live with this for a while, be sure to keep VS2008 installed on your build machines.
I just encountered the undefined __imp___vsnprintf symbol while converting an ODBC application to Visual Studio 2015. Figuring that there must be a workaround, I dumped all the symbols exported by the various libraries in the Visual Studio 2015 LIB directories with DUMPBIN and found that this library with a most obvious name, legacy_stdio_definitions.lib, defines these symbols.
Adding this to the LINK command line resolved the missing external referenced by odbccp32.lib.
Once one knows what to search for, some info is available here.
Don't know all the details, so shooting in the dark. When I had a situation when certain functions were available with one compiler and not the other, I created a simple DLL with the functions exported with C interface, using compiler version that supported those functions, and used that DLL with another compiler.
the solution is to link with just odbccp32.lib from v6.0 sdk all else from the default sdk.
1. download v6.0 sdk from: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=ff6467e6-5bba-4bf5-b562-9199be864d29&displaylang=en
(do not install documentation and samples/examples, the result is 75MB downlaod):
2. create a folder, some folder.
for example: lib_odbc_fromsdkv6.0 in your project's folder
3. copy the file odbccp32.lib from:
C:\Program Files\Microsoft SDKs\Windows\v6.0\Lib
to folder created above (only one file).
4. in each project's properties add that (lib_odbc_fromsdkv6.0) directory to Library directories:
VC++ Directories -> Library directories
the depended projects in myodbc are myodbc5S and myodbc-installer.
(from Mordachai)

Why is VisualStudio looking for this lib file? LNK1104 error

We have a large project using VS2008 and boost 1_42. I'm trying to upgrade to VS2010 and boost 1_44. I installed VS2010 and boost 1_44 and converted the project. Now I am trying to build, and everything compiles, but fails when linking:
LINK : fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-1_42.lib'
I have changed the include and lib directories to point to the new boost 1_44 files and I have renamed the old boost 1_42 directory.
Why is the linker still looking for a vc90-1_42 file, when it is only using 1_44 headers? Is there a way that I can determine WHY the linker wants this file? The linker obviously thinks it needs the file, but why?
I have cleaned the project and I am re-building to ensure any old build files are erased.
I've run into exactly this problem a couple of times too. It's usually been some old temporary files but like in your case cleaning didn't always do the trick straight away. Does your project include any static libs that might have been built with 1.42?
Something you can try which may or may not be helpful in tracking down your issue:
Rename the old boost directory back to it's original name
Clean the solution
Under C/C++->Command Line->Additional Options add "/showIncludes"
Under Linker->Command Line->Additional Options add "/verbose:lib"
Rebuild all
Then when you build you'll be able to see at which point 1.42 headers are included, etc. in the output window. Somehow doing this helped me in tracking down where the problem was.
Along with changing the lib directory, you need to change the name of the boost library. That's in the Linker | Input section of the project settings.
Your added comment makes it clear that the dependency on the Boost 1.42 library was being created indirectly by another library that hadn't been rebuilt.
For this you basically have two choices: either add that library as a project to your main solution, and make sure it has enough dependency information that it'll be re-built when you upgrade Boost, or use the /Zl compiler switch when you build your library. This tells the compiler you're building a library so you do not want to embed library dependencies like this.
Boost uses
#pragma comment(lib)
command to inform the linker of libraries it needs to link with. It is not an error. If Boost says you need it, it's likely you do.
On How can I find out why the linker wants this file?
There are programs which will go through your app and dlls/libs and report the content of manifests and what the binaries report they depend on. You could then scan the report for the unexpected libraries being included. We used this mainly to find libs including the previous version of the VC runtime.
Have not used the one we had in about 5 years though, now if only I could remember the name of the app!
DependancyWalker (depends.exe) will allow you to see dependancies of dll/exe but not static libs.
You could open each binary as a 'file' in MSVS and look at the manifest content by hand, but I imaging this would be a bit painful. I've not tried this with a static lib.

C++ Library Include

I am relatively new to C++ and need to use a library for the first time.
I was hoping someone would be able to show me how to properly [ link to / include ] the library.
The library I want to use is the ID3 v3.8.8 that can be found here:
http://id3lib.sourceforge.net/
I have downloaded the Windows binaries and now just need a way to link to the library.
Files downloaded: Debug/id3lib.dll, Debug/id3lib.lib, Debug/id3lib.exp, Release/id3lib.dll, Release/id3lib.lib, Release/id3lib.exp
I am using Visual Studio 2010.
Any help is greatly appreciated. Thanks in advance.
Before you can do any C++ development with this library you'll need the headers too which are in the id3lib-3.8.3.zip file. You have only downloaded the binaries which will let you run an application that needs those libraries but not re-compile it.
There are several steps, and many a pitfall. If you are a rank newbie at using C++ and VC++ in particular, every step is going to require some (gasp) reading of documentation or googling.
In VC++ 2010, use the Property Manager "C/C++ General / Additional Include Directories" section if necessary to tell the compiler how to find the header-files.
Use the Property Manager "C/C++/ Code Generation / Runtime Library" section if necessary to tell the compiler what version of the Microsoft C Runtime Library the library requires.
Use Property Manager "Linker / Input / Additional Dependencies " to specify the .lib file id3lib.lib.
Use Property Manager "Linker / General / Additional Library Directories" to tell the linker where to find .lib file.
If the dll id3lib.dll is not in the directory where you will start your program, open a Microsoft Explorer window, and right-click on "My Computer." Select "Properties/Advanced/Environment Variables", and edit the user-variable PATH to contain the path of the directory that contains the dll. Be very careful doing this. Before you change it, copy the value that's there originally and save it to a text file, in case you mess up and need to restore it. If you get it wrong, other programs can fail to start.
Good luck.
Add id3lib.lib to your project, that should satisfy the linker and the resulting executable will depend on id3lib.dll.