Unable to remove Linker error in Visual Studio - c++

I am trying to use OpenCv in Visual Studio 2012. I followed every single step this question has provided and every other that can be found on the internet. I even tried to work with different versions of opencv but the error didn't go away.
The error is:
error LNK1104: cannot open file 'opencv_calib3d230d.obj'
All the required libraries are included in linker configurations of visual Studio. Envoirnmental variable "Path" has also been updated but still the error is there.
What can I do to solve this problem?
I have search for calib3d230d.obj every where but it is not inside the extracted folder.
I downloaded OpenCv superpack.exe from HERE
Regards

Firstly, you should be linking to .lib files, opencv does not normally include any .obj files. Change this in your linker dependencies. Secondly, do you definitely have the debug version of the libraries? If not, then you need to specify the static libraries without the d on the end of the name (opencv_calib3d230d.lib -> opencv_calib3d230.lib).

I encountered the same problem before. Finally I found that I forgot to type ".lib" after the library file in vc++ linker.
Wish this can help you.

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

Error LNK1104 cannot open file ';.obj'

Error LNK1104 cannot open file ';.obj' project1
D:\project1\source\project1\project1\LINK 1
I'm using visual studio 2015 and openframeworks, I'm fairly new to the c++ language.
I couldn't find a line of code which refers to this file.
Has anyone had a similar error or does know any tips to find the cause of this error?
The build-process has two main step:
compile
link
In the compiling stage the obj files are built from the source file. In the linking step these obj files are "concatenated" resolving unresolved references and builds the final output (static/dynamic library or an executable).
Your error is a linker error which says that one of the compiled file cannot be found. This can happen when:
the compilation is failed (check the previous errors if any)
the compilation is skipped for the specified source file for some reason (this can happen when the whole project is excluded from the build process or you specified that it should save the preprocessed file only).
Do you have any other error messages or warnings? Please check if you're actually building the specified project (and the actual source file as well). As a first step, you can check it in the Build -> Configuration Manager. Look at the checkbox in the "Build" column.
How are you setting your input paths for the Linker? For C/C++, I have found for Visual Studio the location listed below is NOT the correct way to reference library files during the compiler-linking stage (at least in Community Version 2017). I had a project folder called 'lib' which contained all my .lib files. Originally I had specified a value like (which was wrong):
Linker --> General --> Additional Library Directories: $(ProjectDir)lib;%(AdditionalDependencies)
I was getting error messages like:
error LNK1104: cannot open file 'lib.obj'
I figured out this was the correct way to specify the library directories:
VC++ Directories --> Library Directories
In my case, my value was:
VC++ Directories --> Library Directories: $(ProjectDir)lib;$(LibraryPath)
I had built a static library, say TempLibrary.lib. I was linking this library with my application and got the above error in VS2015. The problem was, that I was mentioning only the name of the library and I missed the extension. i.e, I had added only the name "TempLibrary" in the
Linker->Input->Additional Dependencies.
After I had added the extension (.lib) to the name, the linker issue got resolved. i.e, TempLibrary.lib

Visual Studio 2010 Assimp library won't link

I seem to have a perpetual problem of never being able to get any library to link with Visual Studio. Ever. I eventually get tired of trying and just include the header and source files manually.
My latest endeavour is trying to set up Assimp. I went and downloaded the latest version and followed the installation guide for Visual Studio 2010. http://assimp.sourceforge.net/lib_html/install.html
The result:
LINK : fatal error LNK1104: cannot open file 'assimp--3.0.1270-sdk/lib/assimp_release-dll_x64/assimp.lib'
I set the include directories:
assimp--3.0.1270-sdk/include
I set the library directories:
assimp--3.0.1270-sdk/lib/assimp_release-dll_x64
I set the additional dependencies (the guide includes the directories, but shouldn't I just be able to just put assimp.lib since I included the library directory above?):
assimp--3.0.1270-sdk/lib/assimp_release-dll_x64/assimp.lib
What am I doing wrong?
Also, considering this isn't my first time having these difficulties, are there any good tutorials to help me understand this process a little better? I've tried searching for it but most are for previous versions of VS...
My guess is you should provide explicitly relative or absolute paths for the library directory.
You're right about the dependency name, assimp.lib is the correct name and the guide is a bit ambiguous here.
Apart from that, you're doing everything right. Provided the lib file exists, it should link.
(assimp co-founder writing here)

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

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.

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