How can I use .dll or .lib Berkeley DB C++? - c++

I cant connect the Berkeley DB C++ library to my VS 2015 project
i download a project of Berkeley DB C++: link
i run the Berkeley_DB_vs2015.sln project from the build_windows folder and compile it
i get the folder x64 > Release and in it libdb_stl181.dll , libdb181.dll , libdb_stl181.lib, libdb181.lib, etc
how can i use this library in other project?
im tried:
#pragma comment(lib, "libdb181.lib")
#pragma comment(lib, "libdb_stl181.lib")
but i cant use:
#include <db_cxx.h>
and i cant use the library elements at all
im tried: "Add reference" in VS15 for add a .dll, but i get:
"as it is not of a type or version current project can use")
also i tried to use "Additional Library Directories" but this didnt give any result
also, the installation via NuGet probably does not suit me, since I could not do:
#include <dbstl_map.h>
ideally, i want to use this
i was able to use this (after installation via NuGet):
#include <db_cxx.h>
but this way i cant insert, for example, STL objects
based on this, i probably dont need to use NuGet.

dbstl_map.h is in directory db-18.1.40\lang\cxx\stl.

Related

How to use jsoncpp with Visual Studio 2022

I need my project to be able to use json format.
I was suggested this github : https://github.com/open-source-parsers/jsoncpp
I have been trying to integrate it to my project for multiple hours and still cant find the issue.
I still get these errors on my include :
#include <jsoncpp/json/json.h>
E1696 cannot open source file "jsoncpp/json/json.h"
C1083 Cannot open include file: 'jsoncpp/json/json.h'
I tried to go to C/C++ General->Additional Include Directories>
to add the "jsoncpp-master\include" directory
also tried "jsoncpp-master\include\json" directory
also tried to add the .h and .cpp found in the repository directly.
I have also tried a multitude of other things but I'm not sure it would be relevant to list them all here.
I was not able to find instructions to use it with Visual Studio 2022 on their github either.
Safest and most convenient way to use third party libraries is to use package manager like vcpkg
https://vcpkg.io/en/index.html
https://github.com/microsoft/vcpkg
Choose what build you want x86 or x64 and set default triplet in your environment variables
VCPKG_DEFAULT_TRIPLET
x64-windows - DLL Build 64-bit windows
x86-windows - DLL Build 32-bit windows
x64-windows-static - Static Build 64-bit windows
x86-windows-static - Static Build 32-bit windows
If you have added jsoncpp-master\include to C/C++ General->Additional Include Directories then you should use #include <json/json.h> instead of #include <jsoncpp/json/json.h>
Explanation : The compiler is looking inside the include directory. If you observer the file structure you can see json folder is located in the include directory and not jsoncpp.

Can't Import Headers for Libpqxx on Windows

I am having some difficulties understanding how to link the header files of libpqxx. I have generated the output using CMake and then built the Release x64 version of it using Visual Studio. When I go to #include the headers, I can't #include them. According to the documentation, there should be as the header, but when I try and enter that, it gives me an error. I have tried to go into the project settings and set the include folder of the built version of libpqxx as an additional include dependency.
Does anyone happen to have any experience with this?
Thanks!!

Linking Codeblock glut project with assimp library

Hello I am new with assimp and have a problem.
When I try to include the:
#include <assimp/cimport.h>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
in a c++ glut project it says No such file or directory, so I obviously need to link some libraries to the project. The question is where can I find that library.
I downloaded assimp view 3.0 and opened the object i need to inport in c++ with it and so far it look ok.
http://assimp.sourceforge.net/lib_html/usage.html .. Is the link to how to use assimp with c++ but no info how to link it
You should have read up on the very site you linked.
http://assimp.sourceforge.net/lib_html/install.html
These are installation directions. The very top looks like it talks about using prebuilt libraries and telling you what to link into your visual studio project.
One last note: you are using the c interface according to your question. After reading the documentation I see that they have a C++ specific importer header you may want to use instead.
#include <assimp/Importer.hpp>
EDIT: This answer assumes you are using visual studio of course. However, that link also provides building from scratch instructions as well as other ways of building and installing the library. So if you are a linux/unix user I imagine you can make do with these instructions.

unable to compile examples in ODEINT package

I am trying to solve a coupled set of ODE's in C++, and I have decided that I want to try out odeint (available here) as I have read many good things about it. However I am having compiling the examples that are included in the package. Here is the situation:
So far I have only downloaded the package and extracted it. I am running Visual C++ 6 on Windows XP and I am compiling the example "simple1d". I get the error message: "Cannot open include file: 'boost/config.hpp': No such file or directory".
It is not clear to me what I am missing. Do I need the full boost library to make this work? I was under the impression that ODEINT is a "standalone" package.
Your error says that compiler can not find the boost libraries. You should download them from boost.org and also add them to your header path.
Where did you download and extract the package to? The package homepage says that it's a header-only package, so you only need to let Visual find the header files. I haven't used Visual in a while, but a quick google of something like "Visual 6 add header path" should be a good place to start. Take a look at Where does Visual Studio look for C++ header files?.
Quoting from this page:
Within Visual Studio, go to the Project Settings dialog. We want to change the settings for both Debug and Release versions, so under the Settings For field, select "All Configurations". Under the C/C++ Tab, select Preprocessor options.
The package tarball has a directory called boost: you want to add the path of that directory into the Additional include directories box and then #include <boost/numeric/odeint/config.hpp> in your code.
Update
It appears, then, that you already have the odeint headers installed properly: the file boost/numeric/odeint/config.hpp has a line #include <boost/config.hpp>, which is what visual must be complaining about; so I guess the package is not standalone. It must need other boost header files installed. I can't find anything in either the package homepage or the package tarball that mentions any dependencies, so I suppose you should try to install boost too. Download version 1.51.0 here, and this is the windows documentation.
You must download odeint from http://headmyshoulder.github.io/odeint-v2/downloads.html and Boost c++ libraries from http://www.boost.org/users/history/version_1_51_0.html.
If you use codeblocks right click your project, select build oprions, select Search Directories and add two references one for odeint and one for boost.

C++ 2010: using #include <mysql.h>

I have searched like crazy and cant find an answer. I am trying to use mysql in my c++ project and have #include mysql.h but I need that directory file. Does one exist? I got all my code set up but zilions of errors because the file is missing. I'm following a tutorial but they dont explain where to get that directory. Any help would be great. Thanks!!
I know that that I am too late to post the answer, but just documentation purposes and for those who search for the same error.
Download the mysql server. You can download it from here: http://www.mysql.com/downloads/
Downloading the community server is just enough. Note: choose the zip file. Choose the x32 since the compiler is automatically configured to build with x32 configuration. If you intend to change the compilation configuration to x64, then go ahead and download the x64 zip file.
After download the zip file, create your new blank project. If you are using MSVC++Express2010, Open the project properties | C/C++ | Additional Include Directories. Add the path to the include folder found in the extracted folder.
Copy the library files found in lib folder in the extracted folder to the project directory where you can find your *.cpp files.
Add the following lines to your code:
#include <my_global.h>
#include <mysql.h>
#pragma comment(lib, "libmysql.lib")
Now you are ready to go :)
You can try the code found here to see if things went right or not.