Fatal error “LNK1104: cannot open file 'libCbc.lib'” when I compile a C++ project in Visual Studio 2017? - c++

I've never used VS before.
My friend shared with me his program working and running correctly (she uses VS 2013 and I use 2017 - any compatibility problem?).
I've downloaded it and changed the paths on
Configuration Properties, C and C++, General, Additional Include Directories (picture below)
Configuration Properties, Linker, General, Additional Library Directories
However Im getting one fatal error which does not find this file located in:
Users\Julio\Documents\CPFL\SolverCPP\coin\libdebug
Users\Julio\Documents\CPFL\SolverCPP\coin\lib
How can I solve this path error? Also any tip to share project is welcome,

Related

Linking libpqxx from Visual Studio 2015 on Windows 10

I've recently decided to try out PostgreSQL as the database platform for some C++ development I'm working on. I decided to use libpqxx as the connection library for my project, and quickly found out this would be an uphill battle to do from VS 2015 on a Windows 10 machine.
After much teeth-gnashing and nail-biting, I have gotten libpqxx to compile on Windows 10.
This leaves me with the following directory structure
Per libpqxx's documentation, I also placed a copy of libpq.dll in my project's executable directory. Please note: I have done this for both debug and release builds, tried to build both, and ended up with the same result.
All the tutorials I've seen seem to indicate that the library can be used after linking it and simply #including pqxx/pqxx, so I set up a small project to do just that. I receive the error:
fatal error C1083: Cannot open include file: 'pqxx/pqxx': No such file or directory
When attempting to build the project. I have also tried this will both debug and release builds, to no avail.
Here is a screenshot of my linker settings.
Does anyone have any suggestions for how I might be able to link and use this library from Visual Studio 2015?
As Sami Kuhmonen pointed out, this was not actually a linker error, but a compiler error. I needed to include an actual header, which Visual Studio needed to be able to find. After adding the correct folder (C:\libpqxx\include in my case) to Visual Studio's "additional include directories" setting under C\C++ -> General per drescherjm's suggestion, the program compiles just fine.
For future reference:
I did also run into unresolved external linker errors after solving the initial issue. This is because you need to make sure to also link to ws2_32.lib and libpq.lib. You also need to copy some other DLL files that libpq also relies on into your libpqxx lib folder. On my system, I believe these were ssleay32.dll, libeay32.dll, and libintl-8.dll. These files reside under the root of the PostgreSQL install. The DLL step is mentioned under libpqxx's INSTALL.txt file, however I believe it stated that the DLLs resided one folder under where I actually found them.
I have also faced same issue. Then I realized that I was building ,my application as a 32bit. I changed the target to x64 and it compiled successfully

cannot open file 'libboost_log-vc120-mt-1_58.lib' in VS 2013 C++ project

I am attempting to compile a project in visual studio 2013 that is using boost 1.58.
I am receiving this error:
Error 3 error LNK1104: cannot open file 'libboost_log-vc120-mt-1_58.lib'
This entry is in my VC++/General/Library Directories
$(BOOSTDIR)\lib\x64
the value of my BOOSTDIR directory is
C:\Projects\boost_1_58_0
I have verified that the path C:\Projects\boost_1_58_0\lib\x64 has the "libboost_log-vc120-mt-1_58.lib" file.
What could I be missing?
I resolved the issue by rebuilding boost and then adding the new lib location as follows:
Add $(BOOSTDIR)\libs;$(BOOSTDIR)\stage\lib; to Additional Libraries
Add $(BOOSTDIR) to Additional Include Directories
I'm guessing there was a compiler mis-match between my project and whatever boost was built with (even though my coworker told me it was built using the same compiler). Or it could have been the path was wrong or missing.

Microsoft Visual Studio 2013 Link Error 1104

A while ago I attempted to make make a game using c++ and SDL. I am now taking a class that requires me to program in C++ and I would like to use VS as the IDE. I uninstalled VS 2012 and upgraded to 2013. I am able to compile c# code but when I make a c++ project I get the error
error LNK1104: cannot open file 'SDL.lib'
I went to the project properties -> Configuration Properties -> Linker -> input and made sure that SDL was not referenced there. My Additional Dependencies now has the value %(AdditionalDependencies). The rest of the options are blank. I also made sure that in VC++ Directories the Include Directories did not include anything related to SDL. Having done all of this I still get the same error. Is is somehow inheriting the SDL linker. The project only contains a hello world program which does not include any other libraries. Any help is appreciated.
You can try this:
Right click the project and choose Properties.
Open Configuration Properties --> Linker -->Input.
In the Ignore Specific Default Libraries entry, add SDL.lib.
BTW, whatever you add in your Include Directories cannot cause a linkage error (and neither can any include that you have in your project).

Building & Linking FreeImage with Visual Studio Express 2013

I'm having a lot of trouble linking my project with FreeImage library with VSE 2013
I've followed this answer for VS2010 to no avail: Linking FreeImage as a static library in VS2010?
I am getting LNK2019 errors when calling FreeImage functions.
I've linked the library just as I would any library. Below are the following steps I made:
Download FreeImage Source.
Open the 2008 Solution (converted to 2013) and changed Code Generation to /MDd for all projects
Attempted to build project but for some reason min/max functions were not defined So I included algorithm.h to those files and that stopped those errors.
Attempted to build project and I get an error: "Could not open "afxres.h". So I swapped afxres.h with windows.h as suggested in another topic.
Built the project -> success
Copied Fresh FreeImaged.lib to to my project
Added directory to "Additional Library Directories"
Added FreeImaged.lib to Additional Dependencies under linker
Copied FreeImaged.dll to my debug folder where the .exe is being built
Added FreeImage.h to the project
Added #define FREEIMAGE_LIB before including the header
Attempted to build my project -> LNK2019s everywhere.
If anyone has been able to build FreeImage on VS2013 and could share how they did it I would greatly appreciate it, or if anyone has any suggestions.
The reason for your troubles is that with Visual Studio 2013 some breaking changes (as outlined by Microsoft) were introduced in related to C++11 conformity.
One includes that in order to use std::min()/std::max(), you now have to include the header . This also concerns FreeImage. Unfortunately, up until version 3.6.1 (the most recent as of today) this hasn't been fixed yet.
This blog post explains what you need to do to get it to compile. The most relevant part is:
Specifically, you will need to add
include <algorithm>
to the following files:
Source/OpenEXR/IlmImf/ImfOutputFile.cpp
Source/OpenEXR/IlmImf/ImfScanLineInputFile.cpp
Source/OpenEXR/IlmImf/ImfTiledMisc.cpp
Source/OpenEXR/IlmImf/ImfTiledOutputFile.cpp
Source/OpenEXR/Imath/ImathMatrixAlgo.cpp
I was able to get this to work by going into the Configuration Manager unchecking FreeImage and checking FreeImageLib under build. Also disabling whole program optimization seems to make the binary size more normal and, gets rid of warnings when linking.
I know this question is over a year old. Just providing an answer to anyone google searching this problem like me.
version: FreeImage3170Win32Win64.zip
os.env.: win7 64bit visualstudio ULTIMATE 2013
operation:
1_ just unpacking the zip somewhere
e.g. (D:/library/FreeImage3170Win32Win64/FreeImage)
2_ in C/C++->General->Additional Including Directerories
add (D:/library/FreeImage3170Win32Win64/FreeImage/Dist/x32)
3_ in Linker->General->Additional Library Directerories
add (D:/library/FreeImage3170Win32Win64/FreeImage/Dist/x32)
4_ in Linker->Input->Additional Dependency
add (FreeImage.lib)
PS0: i just add a new entry to Include Directories and Library
Directories and FreeImage.lib to Linker->input in Visual Studio without rebuild the FreeImage library
:)
PS1: error LNK2019 occured when i added the FreeImage/Dist/x64 option
;( ( got no idea about this)
maybe this helps :)

C++ code library open error in Visual C++

I am beginner developer in the VC++ environment. I used C++ code under the VS 2012 for NUnit Testing.
I was trying a code in the test project but it keeps generating an error that a library file is not being opened. I checked in the project properties and there is a library named: Microsoft.VisualStudio.TestTools.CppUnitTestFramework.lib
but it still generats an error
LINK : fatal error LNK1104: cannot open file 'Microsoft.VisualStudio.TestTools.CppUnitTestFramework.lib'
Does anybody solved such problems before or you remmend me to do ?
Yes, I had this Problem too. I am working on VS express 2013, and I had created a new unit for an unmanaged dll and a test unit, which refers to.
To overcome,
I found out, where the named CppUniTestFramework.lib is. It is not, where your VS Project files are.
I found it under C:\Program Files(86)\Microsoft Visual Studio 12.0\VC\UnitTest\lib
I navigated to the file in Windows Explorer, copied the pathname out of properties and added this in Unit test Project properties under
Linker - > Allgemein -> zusätzliche Bibliotheksverzeichnisse (Linker - > General - > Additional Library Directories).
I feel, this is not a nice solution, but it works now. I see now my first unit tests running.