How to install Boost on Windows 7 with VS - windows

So I am trying for whole day to integrate Boost with Visual Studio (2008) on Windows 7.
I firstly I went twice trough this How to use Boost in Visual Studio 2010.
I searched over all (there are at least 3 of them) simiral topics and none of them worked.
Some people proposed using this one : www.boostpro.com/download/ but link is not active.
Someone proposed to change runtime library to Multi-threaded DLL but is also didnt work.
I just try to include #include <boost/thread.hpp> and got this error
fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-s-1_53.lib'.
Before installing Boost the error was that it cannot find the thread.hpp so it seems like the Boost is installed somewhat correctly.
The problem is that the libraries were not build while I was using the tutorial. How can I build them manually?

There's no such thing like one-click boost install, you still need to do something manually. In your case it seems you need to compile Boost.Thread library and then add directory where resulting .lib file is to your library path. The link you provided looks pretty good. If you followed it probably you already built Boost.Thread. Make sure you did #6 from the second part.

There are prebuild binaries - installation packages:
http://sourceforge.net/projects/boost/files/boost-binaries/1.53.0/

Use this command:
bjam --build-dir=build-directory toolset=toolset-name --build-type=complete stage
this build the libraries manually. Then add the new directory to additional libraries path
as it is indicated in this link:
http://www.boost.org/doc/libs/1_43_0/more/getting_started/windows.html#or-build-binaries-from-source

I found this article quite helpful:
http://www.codeproject.com/Articles/11597/Building-Boost-libraries-for-Visual-Studio
The article explains how to build the build tool BJam (mainly by locating the boostrapper.bat)
How to build the libraries, e.g. bjam toolset=msvc-11.0 variant=debug threading=multi link=static (in this case the VS2012 multi-threaded, statically linked debug version).
It also features build batches, but I haven't tried them.
It has some additional information on how to specifiy the used C-Runtime

Related

How to install libxml++ in Visual studio? Does nmake "see" vcpkg packages?

I am having troubles installing libxmlplusplus (https://github.com/libxmlplusplus/libxmlplusplus) in Visual studio.
It is extremely annoying libxml2 wrapper that someone used to parse setup for project I am working and it has so many annoying little dependencies that I am tempted just to rewrite setup parsing with new code as I want to distribute this project as open source and I wish to no one to go through with installation of this library.
The README file in MSVC_NMake directory states that I only need to install libxml2 and include it in my VC directories.
Now I know that this hellish library also needs glib, and glibmm as few years back, this person http://hostagebrain.blogspot.com/2015/07/building-libxml-by-visual-studio.html went through horrible ways to build everything in VC when I am assuming glibmm and libxml2 were not easy to get.
I installed glibmm and libxml2 via vcpkg.
I downloaded libxmlplusplus, went to MSVC_NMake directory and run:
nmake /f Makefile.vc CFG=release
I am getting error messages as:
..\libxml++\attribute.cc: fatal error C1083: Cannot open include file: 'msvc_recommended_pragmas.h': No such file or directory
So it seems some dependency is not linked, but have no idea which.
I checked ..\libxml++\attribute.cc and went down the include labyrinth to find out that it includes libxml\tree.h and libxml is part of libxml2, so I am suspecting libxml2 was not linked properly.
I exited powershell and then went to manually set VC includes and library dirs to vcpkg/packages/xxx location where they are installed, but I am still getting the same error.
I added glibmm to VC dirs, I even installed gtk and linked to VC hoping it'll find the missing header.
Can someone please help? Shouldn't vcpkg packages be in "path" when running nmake automatically? Am I missing completely different dependency?
nmake won't magically see vcpkg installations. You need to either setup the environment variables (LIB/LIBPATH/PATH/INCLUDE/CL/LINK etc) for it or provide the paths to vcpkg in some other way.
That being said libxml++ is a available port in vcpkg -> see libxmlpp

Errors while installing/using dlib for use with Eclipse CDT, MinGW and OpenCV

I use Eclipse Neon CDT with MinGW. I have CMake at my disposal.
I want to work with dlib and OpenCV in Eclipse CDT, and be able to compile my project just by clicking on the 'Build' button, without having to leave Eclipse, if possible.
I am working on a project that requires both OpenCV and dlib. I've successfully installed OpenCV and tested it with some programs to make sure it works. However, I'm having problems using dlib.
I used CMake gui to Configure/Generate,mingw32-make and mingw32-make install commands to set up my dlib library. This library was at C:/Program Files/Project and contained three folders include, lib and share
I started a new Project in Eclipse CDT and set my include paths to C:/Program Files/Project/include and added the following libraries (all .dll files)-
gdi32, comctl32, user32, winmm, ws2_32, imm32
When I went ahead and copy/pasted the code from the example file, face-landmark-detection-ex.cpp and tried to build it, the Build Console displayed these errors.
These are the statements that caused the errors -
image_window win, win_faces; (line 34),
win.clear(); (line 52) and
win.add_overlay(render_face_detections(shapes)); (line 54)
I don't know if it's relevant, but when I tried the method mentioned, in the answer of this question, the build was successful and the executable worked, but I couldn't include OpenCV headers and libs this way, so I had to look for other solutions.
Did you look at the instructions on dlib's how to compile page?
Compiling C++ Examples Without CMake
In most cases, to use this library all you have to do is extract it
somewhere, make sure the folder containing the dlib folder is in your
include path, and finally add dlib/all/source.cpp to your project.
It doesn't sound like you added dlib/all/source.cpp to your project.

Boost installation error: No toolsets were configured

I've been trying this for over 5 days and I have no idea how to get this to work. I had successfully installed boost once, then I got my computer re-imaged and now it's just not happening. I have Windows 7 Enterprise, and 64-bit operating system.
I downloaded boost from here sourceforge
unzipped it into program files.
I then went to the VS 2013 Native Command prompt. Changed directory to boost tools/build
Ran bootstrap.bat
I then ran ./b2 address-model=64
but it did not give me directories for the compiler and the linker like last time.
I then ran ./b2 --prefix=C:\ProgramFiles\boost_1_58_0
but again nothing happens. I get the following errors:
Warning: No Toolsets were configured.
Warning: Configuring default toolset ""msvc"
Warning: If the default is wrong, your build may not work correctly
warning: Use the "toolset=xxxxx" option to overrride out guess
warning: for more configuration please consult
I have no idea why this worked the first time I had done this and why this isn't working now. Can someone please help me out. I know nothing about Unix but I need to install this so I can use the libraries.
I compile boost with both mingw (64 bit) and msvc 2013 pro. I have never in my life used the vs command prompt to build boost with msvc. Here are my commands to build 64 bit binaries on both toolchains.
First go into the boost folder and just double click bootstrap.bat. This should run and build bjam/b2. Nothing special required and doesn't matter what compiler this gets built with.
Then simply run, in a normal command prompt:
bjam.exe -a -j8 --toolset=msvc --layout=system optimization=speed link=shared threading=multi address-model=64 --stagedir=stage\MSVC-X64 release stage
Where -a forces rebuild all, -j8 means for the build to use 8 cores (adjust this based on your processor capabilities), toolset is obvious, layout means how to structure the naming of the output files, address-model is obvious, stagedir is where to output the built binaries (either relative or absolute path) and release stage is the type of build the system. See more here.
Same thing but using 64 bit mingw.
bjam.exe -j8 --toolset=gcc --layout=system optimization=speed link=shared threading=multi address-model=64 --stagedir=stage\x64 release stage
You can even go on to build additional libraries with a second pass tweaking your arguments. For example, after I've built the core libs with the above command, I run the following command to build in zlib and gzip support.
bjam.exe -a -j8 --toolset=msvc --layout=system optimization=speed link=shared threading=multi address-model=64 --stagedir=stage\MSVC-X64 --with-iostreams -s BZIP2_SOURCE=C:\dev\libraries\cpp\bzip2-1.0.6 -s ZLIB_SOURCE=C:\dev\libraries\cpp\zlib-1.2.8 release stage
Anyway that's just as an example. I linked to the full docs for the build system. Try building using these commands NOT inside a vs command prompt. If you still have problems then please post specific errors.
A note about MSVC
So, msvc compiler + boost supports a type of linking where it will automatically include additional libraries that it knows it needs. I believe boost does this by using the #pragma directive in headers. For example you might use boost::asio configured in such a way that it needs boost::system (for error codes and such). Even if you don't explicitly add boost::system library to the linker options, msvc will "figure out" that it needs this library and automatically try to link against it.
Now an issue arises here because you're using layout=system. The libraries are named simply "boost_" + the lib name, like "boost_system.dll". However, unless you specify a preprocessor define, this auto linking will try and link to a name like "boost_system_msvc_mt_1_58.lib". That's not exact as I can't recall the exact name, but you get the idea. You specifically told boost to name your libraries with the system layout (boost_thread, boost_system) etc instead of the default, which includes the boost version, "MT" if multithreaded, the compiler version, and lots of other stuff in the name. So that's why the auto linking feature goes looking for such a crazy weird name and fails. To fix this, add "BOOST_AUTO_LINK_NOMANGLE" in the Preprocessor section of your C++ settings in visual studio.
More on that here. Note that the answer here gives you a different preprocessor definition to solve this problem. I believe I ended up using BOOST_AUTO_LINK_NOMANGLE instead (which ended up working for me) because the ALL_DYN_LINK macro turned out to be designed as an "internal" define that boost controls and sets itself. Not sure as it's been some time since I had this issue, but the define I provide seems to solve the same root issue anyway.

How to install OpenCV 2.0 on win32

I need to install OpenCV on Win32. I do not have it installed currently. I downloaded OpenCV-2.0.0a-win32.exe and ran it. What the heck do I do now? There are no .lib's and whatnot.
I found some instructions for building the release using cmake at http://opencv.willowgarage.com/wiki/InstallGuide . I downloaded the latest and greatest cmake, and tried to follow the instructions, but I was guessing. No joy.
I specified VC++9 when I did the "configure," but cmake built a VC++ 6 dsw file. No vcproj. I converted the dsw into a vc++9 vcproj anyway, just to see if it would work. Nope. It compiled lots of files, but many failed because it could not find omp.h. Sure enough, it's not there, anywhere. The build log said, 'A tool returned an error code from "Performing Custom Build Step".'
I am lost.
Ideally, I would like to find a full installation with all the files pre-built for Win32 vc++ 2008. Failing that, I need instructions that even I can follow. Short sentences and small words, but lots of them.
Please help!
UPDATE: I tried to build just CXCORE. It complained, "cannot open file 'VCOMPD.lib'" There's that OMP again.
For version 2.0, you must build the project from source.
Here's what you will need:
The OpenCV installer.
CMake. Here's the CMake installer.
Instructions for using CMake to install OpenCV-2.0.01-win32. Those instructions need an extra step if you are using a vc++ Express edition. In that case you must un-check ENABLE_OPENMP when running the CMake GUI.
Instructions for setting up an application project. (Thanks to mloskot for this find.)
If you've installed OpenCV-2.0.0a-win32.exe then it will install pre-built DLLs and libs. Then you just have to follow the instructions in this tutorial.
I recommend that you wipe the folder you previously installed OpenCV2.0 in and reinstall it.
Update:
Well sorry it didn't work out. I suggest the following then: check out the latest version from the SVN repository, https://code.ros.org/svn/opencv/trunk/opencv with any SVN client - I use TortoiseSVN.
Then run CMake (I see you've already installed it) on the source folder and then compile the Solution file. This should work - it does for me.
I apologize for my old answer - I had started off with OpenCV a few months ago in the same way and assumed that downloading the Gold version would still work - apparently not.
OMP
The OMP issue may arise from the checked Enable OpenMP in the CMake config. Try unchecking that .. might solve your initial problem.
I followed Jive Dadson's procedure to get OpenCV2.0 to work on Visual Studio 2010 Express (disabled OMP).
All went good until compilation of the generated stuff in Debug and Release. In both cases got this error: "LINK : fatal error LNK1181: cannot open input file '../../lib/Release/cv200.lib'"
in debug the only difference is that the library is cv200d.lib.
EDIT: I solved by downloading the latest svn snapshot for OpenCV2.0. One additional thing on Vista/7: it may be good to execute CMake as administrator.
Download OpenCV installer for Windows
Read OpenCV-2.0.0a-win32.Readme.Please.txt
Follow OpenCV with Visual C++ 6.0, 2005 Express, and 2008 Express in order to create project using OpenCV

Building libcurl with SSL support on Windows

I'm using libcurl in a Win32 C++ application.
I have the curllib.vcproj project added to my solution and set my other projects to depend on it.
How do I build it with SSL support enabled?
Well, since this post failed badly, I had to dig into the matter myself.
Also check out the other answers and comments for additional info regarding other versions etc.
EDIT: Since I posted this Q there seems to be ready-built binaries made available from the curl homepage. Check out James' answer.
So here goes:
-
Preprocessor
The following two symbols need to be fed to the preprocessor to enable SSL for libcurl:
USE_SSLEAY
USE_OPENSSL
(libcurl uses OpenSSL for SSL support)
Alternatively the symbols can be added directly to a file called setup.h in libcurl, but I'm not too happy about modifying code in 3rd party distributions unless I really have to.
Rebuilding the libcurl library, I now got some errors about OpenSSL include files not being found. Naturally, since I haven't set up the OpenSSL distribution properly yet.
Compiling OpenSSL binaries
I downloaded the OpenSSL 0.9.8 source distribution and unpacked it.
In the root of the source distribution there's a file called INSTALL.W32 which describes how to compile the OpenSSL binaries. The build chain requires perl, so I installed the latest version of ActivePerl.
I had some trouble with the build, which might not be applicable to all systems, but I'll go through it here in case somebody experiences the same.
According to INSTALL.W32:
Run the following commandline tasks with current directory set to the source distribution root:
1> perl Configure VC-WIN32 --prefix=c:/some/openssl/dir
(Where "c:/some/openssl/dir" should be replaced by the dir where OpenSSL should be installed. Don't use spaces in this path. The compilation further ahead will fail in that case)
2> ms\do_ms
For me this step was unsuccessful at first, since I lacked the environment variables OSVERSION and TARGETCPU. I set these to 5.1.2600 and x86 respectively. You may get complaint about OSVERSION being "insane", but look closer, this error is for WinCE and doesn't affect the Win32 setup. To get hold of your OS version, run the 'ver' command from a command prompt or run winver.exe.
3> nmake -f ms\nt.mak (for static library)
or
3> nmake -f ms\ntdll.mak (for DLL)
The source now compiles. Took approx 5 minutes on my laptop.
When compilation is completed, the libs or binaries have been placed in:
distroot/out32 - for static library build
or
distroot/out32dll - for DLL build
Building and linking
Now, back to visual studio and point out the libs and include path for headers. The include files are located in distroot/inc32/openssl.
Remember to add libeay32.lib and ssleay32.lib as linker input.
Rebuild the libcurl project.
Error!
Well at least for me with this version of OpenSSL.
it complained about a struct typedef in one of the OpenSSL headers. I couldn't find any info on this. After an hour of googling I broke my own principle and commented out the typedef from the OpenSSL header, and luckily libcurl wasn't using that symbol so it built fine.
Update: As pointed out by Jason, this issue seems to have dissapeared as of version 1.0.0a.
Now, for confirming that SSL support is enabled for libcurl, run the following code:
curl_version_info_data * vinfo = curl_version_info( CURLVERSION_NOW );
if( vinfo->features & CURL_VERSION_SSL )
// SSL support enabled
else
// No SSL
Simple as that.
Maybe this isn't the answer anyone is looking for, but I simply just downloaded the precompiled DLLs from this link found at http://curl.haxx.se/download.html
I ran the test that sharkin provided, and if( vinfo->features & CURL_VERSION_SSL ) proved to be true.
Following Robert Oschler's advice, here is my comment on the question as answer :
You can build recent libcurl (2012) with native SSL support for windows using the preprocessor symbols: USE_WINDOWS_SSPI and USE_SCHANNEL instead of the OpenSSL ones.
When compiling OpenSSL 1.0.0 on Windows with Visual Studio 2010, it eventually threw a 0x2 error:
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\BIN\cl.EXE"' : return code '0x2'
Stop.
It seems that this error will be thrown because of a flag in the perl Configure file, namely -WX.
As the MSDN documentation states:
Treats all compiler warnings as errors. For a new project, it may be best to use /WX in all compilations; resolving all warnings will ensure the fewest possible hard-to-find code defects.
After removing the -WX occurrences in the Configure file and re-entering the commands stated here it built fine and passed all tests.
In my case follow the curl README file was enough.
My configuration is the following:
Visual Studio 2015 (VC14)
Static library
Win64
curl version 7.57.0
OpenSSL 1.0.2
Compilation of libCurl
Download libcurl source there: https://curl.haxx.se/download.html
Uncompress the file and go to the folder curl-7.57.0\projects
Open the README file and follow the instructions, this lead me to do the following:
Downloaded OpenSSL
Extract it and rename it to openssl, put it aside the curl folder, this is important as you'll open the VS project that expect to find openssl there.
Install Perl
Execute the utility build-openssl.bat to perform the compilation of openSSL. With my settings this became the following:
.\build-openssl.bat vc14 x64 release ..\..\openssl\
just runs .\build-openssl.bat -help to know more about the parameters.
After that you can see OpenSSL has been compiled as you got a new folder here: openssl\build\Win64
Open the Visual Studio project curl-7.57.0\projects\Windows\VC14\curl-all.sln
Be sure to set the visual studio project to the build configuration you need (LIB Release - LIB OpenSSL in my case)
Build all
The library is located at curl-7.57.0\build\Win64\VC14\LIB Release - LIB OpenSSL\libcurl.lib
Remarks
Don't forget to define the CURL_STATICLIB preprocessor in your own project
With static library, you will have to links with the dependencies of libcurl, see this answer
You might not want to depend on LDAP, in that case you can disable it by setting the preprocessor CURL_DISABLE_LDAP before you compile libcurl.
If you build with Visual Studio IDE and get 58 odd warnings as the likes of
"inconsistent dll linkage curl_global_init / curl_msnprintf /..."
you should add CURL_STATICLIB to the preproccessor definitions.
so the entire definition line should look like:
USE_SSLEAY;USE_OPENSSL;CURL_STATICLIB.
With this all the warning will disappear.
Some would ignore the warnings and go on using the libs, but then will get corresponding *error*s as the likes of curl_global_init / curl_msnprintf. It can be very annoying.
Hope it can help somebody.
\ fatal error C1083: Cannot open include
file: 'stdlib.h': No such file or directory
NMAKE: fatal error U1077::return code
That error can be solved by executing vcvarsall.bat in Visual Studio.
How to build libcurl C/C++ with OpenSSL (SSL support) on Windows
Install libcurl
Install OpenSSl
Build libcurl with OpenSSL
Installing libcurl
Go to the download page of libcurl and donwnload the ZIP file under Source Archives. In my case it is called curl-7.58.0.zip
Extract the archive and open projects/Windows/VC15/curl_all.sln with Visual Studio.
Installing OpenSSL
Download the windows binary of OpenSSL. In my case, I downloaded the windows installer file Win32 OpenSSL v1.1.0g from the Shining Light Productions distribution.
The installation folder for me is C:\OpenSSL-Win32.
Building libcurl with OpenSSL
In the curl_all.sln Visual Studio solution file, change the build configuration to DLL Debug - DLL OpenSSL.
In the Solution Explorer, right click the project curl and go to Properties.
Under Linker -> General modify Additional Library Directories and add the path to your OpenSSL directory + \lib. In my case, this is C:\OpenSSL-Win32\lib.
Apply and close the properties window.
Right click the project libcurl and do the same as the previous step, add OpenSSL directory + \lib to Additional Library Directories under Linker -> General.
Under C/C++ -> General, add C:\OpenSSL-Win32\include to the Additional Include Directories.
Finally go to Linker -> Input and modify Additional Dependencies. Replace all the lib files to the following:
ws2_32.lib
wldap32.lib
openssl.lib
libssl.lib
libcrypto.lib
Apply and close the properties window.
With the DLL Debug - DLL OpenSSL build configuration still selected, go to Build -> Build Solution.
Copy the two dll files libcrypto-1_1.dll and libssl-1_1.dll from the OpenSSL bin directory (C:\OpenSSL-Win32\bin) to the just created build directory curl-7.58.0\build\Win32\VC15\DLL Debug - DLL OpenSSL.
Validating Build
Inside the build directory, run curld.exe. If it runs with no errors (missing dll, etc.) then your build was successful.
i did "do_nt.bat" for windows 7 rc7100
don't forget "nmake -f ms\nt.mak install" to copy the headers correctly
thanks this did help a lot
Couple of notes in response to and/or in addition to the above..
First, if you don't want to mess with ActivePerl, Strawberry Perl is terrific and worked perfectly for this.
Second, in lieu of using do_ms.bat, I would recommend preferring do_masm if possible since, according to INSTALL.W32,
This is worth doing because it will
result in faster code: for example it
will typically result in a 2 times
speedup in the RSA routines.
Also, build 0.9.8l (L) of OpenSSL was a nightmare so I eventually gave up and reverted to 0.9.8k which built and linked (statically) with libcurl 1.9 without issue.

Resources