fatal error LNK1104: cannot open file 'opencv_calib3d220d.obj' - c++

I am very new to C++ programming and I am compiling a code in visual studio 2010 with opencv 2.2 library on a Windows 7-64 bit OS using a precompiled header. I listed all the library files available in C:\OpenCV2.2\lib in the Project properties>configuration properties>linker>input, but when I run the program it continues to show this error:
fatal error LNK1104: cannot open file 'opencv_calib3d220d.obj',
although I defined 'C:\OpenCV2.2\lib\opencv_calib3d220d' as an input.
I do not know how to resolve the problem.
Any help would be highly appreciated.

Did you actually define "C:\OpenCV2.2\lib\opencv_calib3d220d" as the input, or "C:\OpenCV2.2\lib\opencv_calib3d220d .lib"? (No space, can't bold/italics it without the space is why it's there.)
It needs to have that .lib there or it won't work. Even if it's complaining about a .obj
Also: Under Linker-> General -> Additional Library Directories you can put "C:\OpenCV2.2\lib\" and then you won't have to type out the directory each time you add something from that directory to Linker -> Input -> Additional Dependancies : You could just put "opencv_calib3d220d.lib", for example.

obj ? no. lib, yes
so, please make sure, you got 'C:\OpenCV2.2\lib\opencv_calib3d220d.lib' etc in your linker input.
also make sure you do the same WITHOUT the 'd' at the end for release
btw, might be a good idea to update to 2.4.6, heap of bug fixes, proper gpu support , facerecognition, do you really want to live without ?

Related

Error when trying to compile using sqlite3_open in Visual Studio 2013

I'm working in a Cocos2dx (c++) win 32 project and trying to use sqlite to save the game data. My knowledge of c++ / Visual Studio is very limited right now.
This is part of the code that I'm trying to compile.
#include <sqlite3\include\sqlite3.h>
...
void HelloWorld::SaveAndLoadTest()
{
sqlite3 *pdb = NULL;
sqlite3_open("writablePath", &pdb);
...
}
But when I try to compile the line with the sqlite3_open command I get the following error:
Error 7 error LNK2019: unresolved external symbol _sqlite3_open referenced in function...
I've been trying to find an answer for this many hours. The most similar question I found was this one but I don't understand the answer.
Error: undefined reference to `sqlite3_open'
You need to link the sqlite3 library along with your program:
g++ main.cpp -lsqlite3
I'm new to Visual Studio and I don't understand how to solve this, anyone?
The error LNK2019 means that references are missing probably because a library is mising.
To add sqlite to a MSVC project, you have to make sure that:
the header is included in your source files
sqlite3.dll is in the path or in the directory of the executable
AND that sqlite3.lib is added to the additional dependencies in the VS project (options of the project > Linker > Input > Additional dependencies)
This last point is mandatory, because the lib tells the linker which functions are stored in the dll.
The solution, quite simply, is to link sqlite3 to your project. Libraries need to be linked (via the linker) for you to be able to use them. Head over here and download the pre-compiled binaries for your platform of choice (in this case, Win32). You may also choose to compile sqlite3 from source. You should end up with a .lib file. Go to Project -> Configuration Properties -> Linker -> General -> Additional Include Directories and add the path to your library file to it. Then go to Linker -> Input -> Additional Dependencies and put in sqlite3.lib.
And remember that you must build sqlite3.lib from file SQLite3.def:
Download source from source (https://www.sqlite.org/download.html)
For example: source https://www.sqlite.org/2022/sqlite-amalgamation-3390300.zip
Or download binary from binary
For example: binary https://www.sqlite.org/2022/sqlite-dll-win64-x64-3390300.zip
Extract both archives to the same directory
Open Developer Command Prompt for VS 2017 by typing Developer Command in Windows Search
Go to directory where you've extracted source code and binary files (via opened cmd)
Run lib /DEF:sqlite3.def /OUT:sqlite3.lib /MACHINE:x64
(Remember if win32, replace "MACHINE:x64" by MACHINE:x86)

VC++ Error: error C1083: Cannot open source file: '=0x0401': No such file or directory

Summary:
Maybe at a glance, it is a common question, but in my case, I don't reach for an answer.
I downloaded a sample hooking program from codeproject, it has three projects, two of them are dll, and one is the main project that use this two dll to perform its primary goal. But when I want to compile it, a project named: KeyBoardHookLib cause an error:
error C1083: Cannot open source file: '=0x0401': No such file or directory
Question:
It is a common question, I do all available solution, but the problem remains. Could please anyone takes a look at this project and give me an answer to compile it.
From the comments of codeproject :
After your converting to VS2010 solution, precompiled header should be changed from /Yu to /Yc in all 3 projects. Delete '=0x0401' in KeyBoardHookLib.vcxproj.

Visual C++: Project/linker depends on library which I can't find in the build options

In Visual C++, I have a solution and in it a project (made by someone else). I know the dependencies of the project, and so I wrote them in by going to the Project -> Properties -> Linker -> Input and inputting the following libraries:
../lib/BWAPId.lib
../lib/BWTAd.lib
../lib/tinyxml.lib
../lib/CGAL-vc90-mt-gd.lib
../lib/gmp-vc90-mt-gd.lib
../lib/mpfr-vc90-mt-gd.lib
../lib/libboost_thread-vc90-mt-gd-1_40.lib
When I try to build the project however, the following message pops up:
fatal error LNK1104: cannot open file 'libboost_thread-vc100-mt-gd-1_40.lib'
Notice the difference: It says the project depends on the "vc100" file, while I know it depends on the "vc90" file. So my question is simply, where could the project possibly have defined that library? I have looked in the "Property Pages" but haven't seen it. Could it be defined in the solution as a whole or something?
Thanks!

linking error: ambiguous libboost*.lib vs boost*.lib

I'm using boost in my project. I've downloaded pre-compiled binaries from here http://boost.teeks99.com/
When linking I receive such error:
Error 18 error LNK2005: "public: void __cdecl boost::thread::join(void)" (?join#thread#boost##QEAAXXZ) already defined in boost_thread-vc110-mt-1_52.lib(boost_thread-vc110-mt-1_52.dll) C:\Oleg\projects\MBClient\FastNativeAdapter\libboost_thread-vc110-mt-1_52.lib(thread.obj) FastNativeAdapter
Why boost contains two lib with so similar name, what is the difference between them?
libboost_thread-vc110-mt-1_52.lib
boost_thread-vc110-mt-1_52.lib
How to fix linking error?
upd I've compiled boost myself. I've added boost_1_53_0\stage\lib directory to linker. This directory actually contains 3 "copies" of "each" file, for example:
boost_atomic-vc110-mt-1_53.dll
boost_atomic-vc110-mt-1_53.lib
libboost_atomic-vc110-mt-1_53.lib
So It's clear what compiler claims about. Somehow it can't understand which version of lib file to use. It's likely connected with static/dinamic linking, but I still can not find the solution. I'm sure my problems is pretty common so I hope someone can suggest me what to do.
I've tried to delete all "libboost*" files from folder but then I receive such error:
Error 15 error LNK1104: cannot open file 'libboost_date_time-vc110-mt-1_53.lib'
I've tried to delete all "boost*lib" files from folder but then I receive such error:
Error 15 error LNK1104: cannot open file 'boost_thread-vc110-mt-1_53.lib'
Then I copied boost_thread-vc110-mt-1_53.lib back and I receive a lot of errors like that:
Error 16 error LNK2005: "public: virtual __cdecl boost::detail::thread_data_base::~thread_data_base(void)" (??1thread_data_base#detail#boost##UEAA#XZ) already defined in boost_thread-vc110-mt-1_53.lib(boost_thread-vc110-mt-1_53.dll)
So when there are no boost_thread-vc110-mt-1_53.lib compiler claims that it's missing, when there is boost_thread-vc110-mt-1_53.lib compiler claims that "function is already defined". Probaly somehow I do use dinamic and static linking at the same time or something like that?
upd2 i've uncommented #define BOOST_ALL_DYN_LINK as suggested here and now code compiles! i'm investigating if everything else is fine. however i didn't understand why I should uncomment #define BOOST_ALL_DYN_LINK so comments are welcome.
Edit: Initial statement removed since an edit to the post changed the situation.
Based on http://www.boost.org/doc/libs/1_53_0/more/getting_started/unix-variants.html#library-naming (as provided by Igor R.):
libboost_thread-vc110-mt-1_52.lib is a static lib (no need for the DLL)
boost_thread-vc110-mt-1_52.lib is the import lib for the DLL
You only need to use one of these.
Another idea/solution to try if you hit the error LNK1104: cannot open file 'libboost_date_time-*.lib' error:
In our project, we include the boost/date_time.hpp file. We define the constant BOOST_ALL_NO_LIB instead of BOOST_ALL_DYN_LINK in our project settings to tell boost not to automatically select which libraries to link against.
See the Boost documentation for more information about this option.
So you could add BOOST_ALL_NO_LIB in Project Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions and check whether this linker error goes away.
I think first of all you need to correct your question. Do you mean (I guess you already know the difference between DLL and LIB )
libboost_thread-vc110-mt-1_52.lib
boost_thread-vc110-mt-1_52.dll
or
libboost_thread-vc110-mt-1_52.lib
boost_thread-vc110-mt-1_52.lib
Anyway, it seems the issue is you're mixing static(libboost_thread-vc110-mt-1_52.lib) and shared (boost_thread-vc110-mt-1_52.lib) boost libraries. But without the working environment and platform details I cannot purpose an exact solution. If you work in Visual Studio ,then you can go to right click on project file > properties > linker > input > ignore specific library and add libboost_thread-vc110-mt-1_52.lib there and try.
asking myquestion myself.
need to uncomment #define BOOST_ALL_DYN_LINK (refer to description)

1>LINK : fatal error LNK1104: cannot open file 'libboost_system-vc90-mt-gd-1_36.lib'

I have created a application for using the libtorrent. In that I am using the boost library. I tried the sample example given in http://www.rasterbar.com/products/libtorrent/examples.html
& tried it in my MSVC 9.0 but I am getting this error
1>LINK : fatal error LNK1104: cannot open file 'libboost_system-vc90-mt-gd-1_36.lib'
how to solve this problem please help me.
Right click the project, and choose "Properties" --> "Linker" --> "General" --> "Additional Library Directories", add your path of libboost_system-vc90-mt-gd-1_36.lib in it.
"Properties" --> "Linker" --> "Input" --> "Additional Dependencies", add libboost_system-vc90-mt-gd-1_36.lib in it.
I am using MSVC 10.0, but I think it is the same.
The simplest way for an amateur like me that is studying c++ on their own.
firstly Unzip the boost library to any directory of your choice.
I recommend you to c:\ directory.
1:open your visual c++.
2:create a new project.
3:right click on the project solution.
4:click on property.
5:click on c/c++.
6:click on general.
7:select additional include library.
8:include the library destination. eg c:\boost_1_57_0.
9:click on pre-compiler header.
10:click on create/use precompiled header.
11:select not using precompiled header.
Then the work now go over to the link library were you experience your problem as an armature.
Firstly,
1:go to were the extracted file was c:\boost_1_57_0.
2:click on booststrap.bat (don't bother to type on the command window just wait and don't close the window that is the place I had my problem that took me two weeks to solve. after a while the booststrap will run and produce the same file, but now in two different name b2, and bjamp.
3:click on b2 and wait it to run.
4:click on bjam and wait it to run.
then a folder will be produce call stage.
then go back to stage 4.
5:click on linker.
6:click on general.
7:click on include additional library directory.
8: select the part of the library eg. c:\boost_1_57_0\stage\lib.
And you are good to go
This solution fixed the linking error issue in MVS 2008 V9 VC++. My error was similar, although the message was slightly different because I have version 1.53.0. Here is my error message:
"fatal error LNK1104: cannot open file 'libboost_regex-vc90-mt-gd-1_53.lib'".
You have to enter the entire path of the directory to the missing lib file. This is the path I had to add to "Properties" --> "Linker" --> "Input" --> "Additional Dependencies". Full path:
"C:\Program Files\boost\boost_1_53_0\bin.v2\libs\regex\build\msvc-9.0\debug\link-static\threading-multi".
NOTE: This fixed the problem which as a linking error in the compilation of the Boost.Regex c++ build example.