Boost libraries and dlls - c++

I have downloaded boost package, and now I want to make dll files and libraries out of the source, but on the net there is no explain for how to do that? Also, I am not sure how to build it to get include files too or whatever comes from it. It would be nice if someone enlighten me with the knowledge how to set up boost for the windows platform. Thanks in advance.

I just wrote an answer for including libraries:
You'll need to include the library in the linkers input.
For VS:
Put the library's file in the solution's root folder. (you might not have to do this in general for some libraries)
At Visual Studios menu go to Project --> [SolutionName] properties.
A dialog will open. navigate to Configuration Properties --> Linker --> Input
At "Additional Dependencies" add the name of the library. (it'll probably be *.lib)

Related

create dll out of yaml-cpp source code

Newbie to windows. I need to use yaml-cpp library in a project, but I can't seem to compile it in windows. I tried everything (everhthing!) I could find but no place have the full answer, just tips for the process. but those tips don't help so much.
I did create shared lib in Ubuntu but can't create dll in windows.
can someone give the full explanation to get dll from source code?
(I also be grateful for explanation of how use the dll with it's includes).
Working with visual studio 2015.
So finally I got it.
for linux users - use cmake. for windows users - you can but I really don't recommend it unless you need cross compiling. Use visual studio: (explained for VS 2017)
First create new project with existing code.
The folder you pick should be "src" (in case of cpp-yaml).
When creating the project you need to choose type of project (exe, dynamic or static library), so choose dynamic library to create .dll or static to create .lib.
After creating your project go to your project properties, go to c/c++ tab --> General --> "additional include directories", and add your path to the headers folder ("include"). Do not add "cpp-yaml" inside the include folder, only "include".
Now build. In the console you can see where the library was created.
To use it, in case you made static library 4 things need to be done:
add to your project "#include cpp-yaml/yaml.h"
in properties:
in tab "c/c++" --> General --> "additional include directories", add the include folder path. (as before)
in tab "Linker" -->Input, add to the "Additional dependencies" your lib name (followed by semi-colon)
in tab "Linker" --> General, add to "additional library directories" the path to your lib.

cannot open file 'SDL2.lib'

I am trying to open sdl2 in my project on Visual C++ 2012 but i keep getting this error:
error LNK1104: cannot open file 'SDL2.lib'
I added the additional libraries and include folder but no luck..
I added the link to the libraries through the linker but i get the same error..
what should i do?
I'm referencing VS 2010, but I've read before that some people have had errors when using the VC++ Directories in their project properties as opposed to the Linker->General->Additional Library Directories.
Unfortunately, there really isn't much more to do besides making sure the directories are linked properly. There really is only one answer to this question. It also may depend on the download of SDL you chose, are you donwloading the Development Library as opposed to the binary?
Watch this video https://www.youtube.com/watch?v=or1dAmUO8k0.
In summary, you want to add the path include folder here: (configuration properties> C/C++ > General> Additional Include Directories),
and add the path of the lib folder here: (configuration properties> Linker > General> Additional Library Directories)
and finally, link .lib file in: linker > input > Additional Dependencies.
It seems like you didn't add your library directory path in VC++ Directories/Library Directories.. You have to link your library directory path (Where you have save you libraries of SDL) in your program. After adding, it will definitely work
I would like to add for others experiencing this problem that its an easy mistake if you are using the Development Library to link to the lib folder. SDL needs you link to either the x86 or x64 folder in the lib folder.
If you run or compile your program before you make those required changes of SDL then you will get this error always.. so first add a c++ file then make those changes and then write something and try to run ..this time it will never give this error
It seems like VS can't find the lib files. There are two ways you can do this. One is to configure the appropriate directories in VS as TwinkleBearDev's article shows. Another is to put the libraries directly where VS would look for them, as my article shows. I don't know if the folders for VS2012 are the same though - might be slightly different.

Fundamental cURL c++ install

With fear of being mocked due to the simplicity I venture out to ask you are question:
What do i have to download and what do i include in my project to get going with the cURL library?
I have tried different things but all resulting in unresolved externals meaning i am including it wrong, i guess.
An explanation of the install process in whole would be awesome! I'm not quite sure exactly what files to use and where to put them. Im using visual studio 2012.
Can anyone shed some light on this?
You need to link the library during link phase of the build. There is an option in the project properties for additional library dependencies - add the .lib file(s) that comes with curl there. Just including a file in your source is rarely enough to use a library.
Ok I am using visual studio (2008) for your work but I will answer to the best of my knowledge.I am assuming you have built libcurl using .sln file or are using a prebuilt set of binaries.
First of all build a solution in project wizard and get a project in it. Right click on project and select properties
In properties go the C++ general tab, add the include directories of curl. Now go to Linker general tab and put the lib directory(which contains the dlls and obj files of your build) in the additional library directories. Now go to input option and put libcurl_imp.lib or libcurldll.a(depending upon your version and compile method). These names can be different and depend upon your build, but the extensions will be of these two types. It is the linker step in which you are making a mistake.
After this compile and run.

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

Made a new project, added main.cpp and wrote the code at this URL:
http://www.boost.org/doc/libs/1_43_0/doc/html/boost_asio/example/echo/async_tcp_echo_server.cpp
Also, added the appropriate include path.
What's next?!?!! It seems like a darn mystery to build a boost code!
Been digging on it for more than 10 hours.
Can anyone give a straightforward answer on how to build the boost library from the code under windows, VC9?
You need to use bjam. It is responsible for creating the libraries that your application will use. Once you use bjam, you are going to need to instruct your project to include the lib file. You do this by going into the project's properties -> Configuration Properties -> Linker -> General. Add the directory which created the lib file to Additional Library Directories. You should be capable of correctly linking after that.
I believe that this link describes the steps better than I could attempt in a post
#bogertron: I want to hug you! (:
So, at last, with a real head ache, I've managed to do so.
The exact steps I took, so others will be saved from the head ache:
Went to http://www.boost.org/doc/libs/1_43_0/more/getting_started/windows.html#or-build-binaries-from-source .
Followed the "5.3.1 Get bjam" clause. Downloaded the "pre-built bjam executable for your platform" at this URL: http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=72941 .
Extracted the ZIP file (my platform is Windows).
Ran "build.bat". It produced the file "bin.ntx86/bjam.exe".
Copied this file to my PATH ("...../boost_1_43_0/").
From a command line, executed "bjam.exe" and waited for about 4-5 minutes.
Then got this message at the console: "The Boost C++ Libraries were successfully built!"
That's it, it even tells you where the include & lib files are.
Not all Boost libraries are header only, Boost.System is one of them. The documentation for Boost.Asio tells you that it depends on Boost.System.
With Visual Studio, the Boost libraries use auto-linking, which means you don't have to explicitly link to the libraries you need. You however need to have the necessary libraries in the library search path, either globally or per-project.
If you don't want to build the Boost libraries yourself, you can use the installers provided by boostpro (only up to Boost 1.42 though at the moment). If you want to build them yourself instead, the documentation covers that well.
I had the same error and i followed the SourceForge. The link will take you to a folder of zipped lib and dll files for version of boost.You can download and unzip related library and when copied it to the related location everything gonna be alright ;)
In Visual Studio, right-click on your project, then go to properties and select:
Properties -> Configuration Properties -> Linker
There you add the full path of your library in the tab named "Additional Library Directories".
From the "Boost Getting Started Directions":
"5.2 Or, Simplified Build From Source
If you wish to build from source with Visual C++, you can use a simple build procedure described in this section. Open the command prompt and change your current directory to the Boost root directory. Then, type the following commands:
bootstrap
.\b2"
On Windows, I opened the Visual Studio Command Line from the start menu. First I types "bootstrap" and then I typed ".\b2".
Now with boost_1.50 the Boost.build is included in the zip file: check tools\build\v2\ or better read: ...boost_1_50_0/more/getting_started/windows.html

C++ Library Include

I am relatively new to C++ and need to use a library for the first time.
I was hoping someone would be able to show me how to properly [ link to / include ] the library.
The library I want to use is the ID3 v3.8.8 that can be found here:
http://id3lib.sourceforge.net/
I have downloaded the Windows binaries and now just need a way to link to the library.
Files downloaded: Debug/id3lib.dll, Debug/id3lib.lib, Debug/id3lib.exp, Release/id3lib.dll, Release/id3lib.lib, Release/id3lib.exp
I am using Visual Studio 2010.
Any help is greatly appreciated. Thanks in advance.
Before you can do any C++ development with this library you'll need the headers too which are in the id3lib-3.8.3.zip file. You have only downloaded the binaries which will let you run an application that needs those libraries but not re-compile it.
There are several steps, and many a pitfall. If you are a rank newbie at using C++ and VC++ in particular, every step is going to require some (gasp) reading of documentation or googling.
In VC++ 2010, use the Property Manager "C/C++ General / Additional Include Directories" section if necessary to tell the compiler how to find the header-files.
Use the Property Manager "C/C++/ Code Generation / Runtime Library" section if necessary to tell the compiler what version of the Microsoft C Runtime Library the library requires.
Use Property Manager "Linker / Input / Additional Dependencies " to specify the .lib file id3lib.lib.
Use Property Manager "Linker / General / Additional Library Directories" to tell the linker where to find .lib file.
If the dll id3lib.dll is not in the directory where you will start your program, open a Microsoft Explorer window, and right-click on "My Computer." Select "Properties/Advanced/Environment Variables", and edit the user-variable PATH to contain the path of the directory that contains the dll. Be very careful doing this. Before you change it, copy the value that's there originally and save it to a text file, in case you mess up and need to restore it. If you get it wrong, other programs can fail to start.
Good luck.
Add id3lib.lib to your project, that should satisfy the linker and the resulting executable will depend on id3lib.dll.