Linker error with boost serialization: missing lib file - c++

I have VC 10 and using boost 1.53.0.
I am trying to compile and link a sample program from boost serialization samples, but the linker generates the following error:
LINK : fatal error LNK1104: cannot open file 'libboost_serialization-vc100-mt-gd-1_53.lib".
I tried many things, like checking my include and lib paths, all was correct. In fact this file name which the linker was asking is not there even in the whole c drive where both MS VC 10 and boost are installed.
Thank you.

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)

error with installing odeint <boost/config.hpp>

I'm trying to install odeint but every time I compile the code, I get this error.
c:...odeint\headmyshoulder-odeint-v2-f496df3\include\boost\numeric\odeint\config.hpp(44): fatal error C1083: Cannot open include file: 'boost/config.hpp': No such file or directory
I've included the include path. I checked this file boost/config.hpp, this is not a complete path to <config.hpp>, so I've changed it to <boost/numeric/odeint/config.hpp>. Now I'm getting an error with other files with the same scenario. Is there a way to fix this problem?
It seems you dont have the boost libraries on your system.
odeint requires boost to be available. The easiest way to get both is by just downloading the latest version of boost, which already contains odeint: http://www.boost.org/users/history/version_1_56_0.html

fatal error LNK1104: cannot open file 'opencv_calib3d220d.obj'

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 ?

wxWidget building problems

I've been trying to install and use wxWidgets v(2.8). I constantly run into the same issue. When building the wxWidgets libraries. I get this error:
error C1083: Cannot open include file: 'zlib.h': No such file or directory d:\wxwidgets-2.8.12\src\png\png.h 346
I can't work out why when I've installed it from the exe. I'm following the instructions from here: http://wiki.wxwidgets.org/Microsoft_Visual_C%2B%2B_Guide
I also get a Linker error which I don't think matters particularly.
Any help would be great. I've tried installing this from the exe and have also just use the zip folder but still run into the same issues. I suspect it might be something to do with environment variables but can't find a definitive answer whether they are required and what they should be set too.
EDIT
Also got something similar here:
error C1083: Cannot open include file: 'expat_config.h': No such file or directory D:\wxWidgets-2.8.12\src\expat\lib\xmlparse.c 30
Cheers
In png.h at line 346 we have
/* include the compression library's header */
#include "zlib.h"
So you need to tell the compiler to look in wxWidgets-2.18.12\src\zlib for headers.
With another install I managed to fix this.

Boost::Archive causing weird linker error

Does anyone have a clue why those two lines would cause that linker error?
std::ifstream ifs("filename.file");
boost::archive::binary_iarchive iarchv( ifs );
Error 8 fatal error LNK1104: cannot open file 'F:\dev\project\build\win32-unit\tests\Debug\framework_core_tests.lib' ramework_core_tests framework_core_tests
The same happens with any Boost::Archive type.
Its trying to link against a library of the same name as my executable for some reason when that project doesn't nor never existed and is not defined as a library to link against in my project files.
maybe you should add a reference to a lib that contains that functions?
You have compiled this library with core tests.