I'm not very C++ savvy yet and have been looking at creating a small project to get better used to the language and so on.
Since what I want to do involves lots of disk scanning and file things I decided to look at the Boost libraries, specifically the filesystem library.
I've been working though this guide:
http://www.boost.org/doc/libs/1_61_0/more/getting_started/windows.html
I'm using Microsoft tools including Visual Studio 2015 on Windows 10.
I downloaded boost in zip format and extracted to:
G:\C++\boost\boost_1_61_0
Then ran the described commands:
> bootstrap
> .\b2
> b2 --build-dir="G:\C++\boost-build" --build-type=complete msvc stage
When this last command completed the small report message at the bottom read:
...failed updating 224 targets...
...skipped 20 targets...
...updated 3804 targets...
I don't know if that signifies problems or not.
Everything seems to have worked so far up until the point where I started to try and consume the binaries (Step 6 in the guide).
I added the other lib directory described in step 6.1. Although the lib directory I have is inside the stage directory, not the boost root as described in the guide.
I added this to the "Additional Include Directories", so that string now looks like:
G:\C++\boost\boost_1_61_0;G:\C++\boost\boost_1_61_0\stage\lib
When recompiling, if I remove the first entry I get this error:
C1083 Cannot open include file: 'boost/regex.hpp': No such file or directory
When I compile with both paths set I get:
LNK1104 cannot open file 'libboost_regex-vc140-mt-1_61.lib'
I've confirmed that the file named is in the directory here:
G:\C++\boost\boost_1_61_0\stage\lib
Pretty confused right now. What have I done wrong here?
Is there a better guide to follow? This guide does seem talk about VS2003 and 2005.
Any advice would be great.
As the name states, "Additional Include Directories" are for the files that you want to #include, which in your case is the G:\C++\boost\boost_1_61_0 directory.
The linker won't search for the libraries in the "Additional Include Directories", because those are not meant to be used for libraries, and it so can't find the boost libraries.
The linker searches "Additional Library Directories" for the required libraries, so you should put the path to the libraries there, i.e. G:\C++\boost\boost_1_61_0\stage\lib.
The property is located in Linker -> General.
Related
I have Visual Studio 2015 and I'm trying to build the sample boost 1.62 link program on the 'Boost Getting Started' page. I followed the build steps in order to compile the various binaries, like regex. These are the steps:
c:\boost> bootstrap
c:\boost> .\b2
I got multiple errors because 'pyconfig.h' was missing, but I don't need this so I thought it was ok.
I set the 'Additional Libraries Directory' in my test project to c:\boost\libs, but at link time, get:
error: cannot open file libboost_regex-vc140-mt-gd-1_62.lib
I looked under .\libs and there were no lib files under there. I did see a new bin.v2 directory under boost\, which, under a very complicate tree has the lib file.
I set the 'Additional Libraries Directories' in my project to c:\boost\bin.v2, but same error.
Can anyone tell me what I need to do to be able to link successfully? Do I need to resolve that pyconfig.h error to get the libs deployed to the right location?
I found the problem. It appears VC++ projects should add an include path to .\boost\stage\lib, instead of what the boost webpage says. I don't know if this is true intention, but it appears to work.
I'm having a few issues getting GLFW3 set up. I've downloaded the 64-bit binaries from the official site, added glfw3.dll, glfw3.lib and glfw3.h to their respective places, specified the proper include, and added the appropriate linker input to my project. However, when I test the library with glfwInit(), VS spits this out:
error LNK1104: cannot open file 'glfw3.lib' Path/To/Project
My guess was that VS didn't know what directory the library was in, but seeing as it's in the IDE's own lib folder, I don't think this is it. Does anyone have any suggestions? Sorry if this has already been solved, I got in as deep as to read the steps of compilation before I gave up searching.
Edit: I also changed the solution platform to x64, since I am using the 64-bit GLFW binaries.
Following Andon M. Coleman's advice, I moved the headers and library folders to a new directory outside of Visual Studio's built-in ones (D:\opengl-wrappers\lib & D:\opengl-wrappers\include, for example). After including those libraries in the project settings (C/C++->General-> Additional Include Directories and Linker->General->Additional Library Directories), everything compiled beautifully.
So i have came along with cURL as a very nice library and working very fine in OSX.
But on windows now i have got big troubles with getting ready with this library. I googled now for about 2 days and tried over a dozen (in detail) different ways to get this ready. Without any success at all.
Here are some ways I basically tried:
The direct Download: The problem here already starts with the right download. The official download page is pretty confusing, so i considered this "cURL Download Wizard" > "libcurl development" which gives me a version, that i should be able to include into any project. But how exactly to include it? In ANY instructions out there it leads me to directories i dont even have. Almost always this "curllib.lib" is mentioned. I downloaded about 6 different versions on that downloadpage, in none of them there is this file. (See for example this instruction)
Git + CMake: As a solution on the aboves Link there is suggested to use git clone on this. I did all the instructions there and also get the Projects generated with just warnings. But here it says as well:
After building install target, your will find bin/include/lib folders in C:\curl.vc12 Well, i did not really get his point of "build install target", i just build the entire project map as it comes. Compiles fine (115 succeeded, 0 failed, 2 skipped). But now C:\curl.vc12 is not there. What do i have to pre-setup before compiling this?
NuGet: The idea comes from the link in point (1) again, a different solution with NuGet.
With Successfully added 'curl 7.30.0.2' to test. it also seemed nice, but compiling simple.c leads to a bunch of unresolved external symbol linker errors. But a solution is provided:
Make sure the include directory and lib directory are specified under the Visual C++ directories in project properties.
So in Project > Properties > VC++ Properties > "Include Directories" and Project > Properties > VC++ Properties > "Library Directories" as well as in Project > C/C++ > General > "Additional Include Directories" and in Project > Linker > General > "Additional Library Directories" I desperately added the \packages\ path from my project folder.
As mentioned in the instructions, I added libcurl.lib;libeay32.lib;ssleay32.lib;Ws2_32.lib;libssh2.lib;zlib.lib;wldap32.lib; to Project > Linker > Input > "Additional Dependencies".
All that done, the unresolved external symbol errors are gone! Therefore I get just one error saying cannot open file 'libcurl.lib'. What can I do here?
I am pretty new to all that. But I am trying really hard now to get this finally to work. So what can I do?
I work with Visual Studio 2013 Community Edition. The currently most recent version of cURL is 7.42.1.
Any help is highly welcome!
Had problems myself, finally got it working now.
I downloaded curl-7.42.1.zip from the official website.
Within the archive you'll find the source code and winbuild/BUILD.WINDOWS.txt, which basically contains the instructions I followed. I'll assume that it has been unzipped to C:\curl-7.42.1.
Open the Visual Studio command prompt located at
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts
This automatically sets the environment variables needed to use Visual Studio tools like the compiler. Then move to the winbuild directory and call
nmake /f Makefile.vc mode=dll
as described in the text file I mentioned above.
That will create the directory
C:\curl-7.42.1\builds\libcurl-vc-x86-release-dll-ipv6-sspi-winssl
containing libcurl.dll, libcurl.lib and the necessary header files. Let's rename it to C:\curl-7.42.1\builds\release :'D
Then open your project.
Open your project's properties.
Make sure you choose Release as configuration (top left corner)!
Navigate to VC++ Directories > Include directories and add C:\curl-7.42.1\builds\release\include
Add C:\curl-7.42.1\builds\release\lib to VC++ Directories > Library directories.
Go to Linker > Input > Additional Dependencies and add libcurl.lib.
Finally copy C:\curl-7.42.1\builds\release\bin\libcurl.dll to your project folder.
That should do the trick! :D If you want to use cURL in debug mode, you can do almost the same, recompile using nmake /f Makefile.vc mode=dll debug=yes, go to your project's properties, add the newly created directory paths (changing libcurl.lib to libcurl_debug.lib) and you should be done.
I had the same issue. I downloaded the curl from https://github.com/curl/curl. you can actually compile it directly with Visual Studio 2013 (but be careful with parameters setting: x64 with release). The major difference is that it gives you libcurl_imp.lib. Then all you have to do is to set the environment variables as described above. Just want to mention, you will have to use libcurl_imp.lib rather than libcurl.lib in the additional dependencies (I suspect this change is because of the new version of curl).
I tried to build log4cxx for visual 2012 and, after 4 hours of resolving errors, the build was succesful (i'm not sure :)).
As a second step I tried to create a vs project to test logging.
I used this example but it keep tell me that
mainapp.cpp(2): fatal error C1083: Cannot open include file:
'log4cxx\logger.h': No such file or directory
I already specified in the linker the path of directory debug in additional library directories and I added "log4cxx.lib" additional dependencies .
I'm confused and I don't know how to make it work
thanks in advance for your help
You also need to add the directory, where headers for log4cxx are. This is not for linking phase, but for compiler phase.
This can be done with Project Properties -> Compiler -> Preprocessor (I think, I don't have VS opened now)
You don't include .lib. This file is for linking.
You need to add to includes the directory, which contains directory log4cxx, and that (log4cxx) directory must contain logger.h!
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