I completely cannot include boost headers - c++

I needed a boost's "filesystem" so I downloaded and successfully build the whole boost. Its directory is C:\Program Files\Boost\boost_1_60_0\boost
Then I created a vs project and specified include directories, additional include directories and library directories. A couple of ways. Tried to add it to the system path, created a system variable bouth with setx an manually.
C:\Program Files\Boost\boost_1_60_0; $(BOOST_ROOT);
"evaluetes to" C:\Program Files\Boost\boost_1_60_0
But I still can't include and use anything.
#include <boost\filesystem> // error
#include "boost//filesystem.hpp" //error
#include <boost\filesystem.hpp> //error
#include "C://Program Files//Boost//boost_1_60_0//boost" //error
// those are working but still useless due to includes in the "filesystem.hpp"
#include "C:\Program Files\Boost\boost_1_60_0\boost\filesystem.hpp"
#include <C:\Program Files/Boost//boost_1_60_0\boost\filesystem.hpp>
#include <filesystem> // does not give an error, but following
using namespace boost::filesystem; //still does
By the way, I worked with boost in this same ide a couple of weeks ago. And things were ok, not sure how I got it working back then though.
What could possibly be wrong? I'm kind of lost.

Assuming you already built the library. You need to right-click on your Visual Studio project and click Properties.
As you can see on those pictures, specify the Additional Include Directories to C:\Program Files\Boost\boost_1_60_0 and Additional Library Directories to C:\Program Files\Boost\boost_1_60_0\stage\lib:
Then click OK
To include the boost filesystem write:
#include <boost/filesystem.hpp>
Let me know if you're still having problems after this.

Related

How to solve error C2334 when include boost library in Visual studio 15?

I have, unziped boost, executeted, boostrap.bat, b2.exe, and in visual studio project properties, in C/C++>General>Additional Include Directories, the root of boost folder, and in Linker>General>Aditional Library Directories, "boost root"/stage/lib".
But when I use #include <boost/filesystem.hpp> I get the following error:
How to solve this?
I found a solution,
if you change the #include <boost/filesystem.hpp> to the begining of the file the problem is solved.

Visual studio 2017: Cannot open include file 'd3dx9.h' no such file or directory in a static library used by .exe application

I am using Visual Studio 2017 and I'm required to use DirectX9.0 for a school project.
I have a solution with 3 projects. One is a static library (.lib), one is an application (.exe) and one is a unit test project:
KB01_Game.exe imports KB01_Engine.lib like so:
KB01_Game properties
KB01_Engine.lib contains the d3dx9 references like so (I have also tried reversing the order of these DXSDK references, with no success):
KB01_Engine properties
The files in KB01_Engine include the directx 9 headers like this:
> #include <d3d9.h>
> #include <d3dx9.h>
> #include <dinput.h>
I have tried the quotation marks too, with no success
> #include "d3d9.h"
> #include "d3dx9.h"
> #include "dinput.h"
KB01_Engine builds successfully. I get no errors saying that there are include files missing. But as soon as I build KB01_Game it gives me this error that is also included in the title, that I have struggled months to fix...
The external dependencies/header files for directx appear in KB01_Engine as expected. When I right click on d3dx9.h and click the option "Open document 'd3dx9.h' " it actually opens the correct document. There are no indications that it can't find the file. I'm strongly assuming that this build error happens because I am using KB01 engine as a static library and not as a regular application.
If you would like to view the code, it is available here: https://github.com/bdeboer95/KB01-Revamped
I fixed it thanks to paisanco's comment by adding these two things:
1) Apparently it is needed to add Library directories too, which I missed in KB01_Engine properties. "Librarian > Additional Library directories"
2) And then I added the include directories for DirectX in KB01_Game properties "C/C++ > Additional Include Directories":

Visual studio cannot find the header files in Additional Include folders

I have been seeing this occasionally, but this project in particular is causing me to tear my hair out.
I have my .cpp.
#include <nppi.h>
#include <cuda.h>
#include <device_functions.h>
#include <cuda_runtime.h>
The Headers are in My project directory, in:
<Project file>\Thirdparty\CUDA\v8.0\include
my Additional includes are:
$(ProjectDir)Thirdparty\CUDA\v8.0\include
i have also tried:
Thirdparty\CUDA\v8.0\include
The includes are not found by intellisense, and i cannot open them with a right click. What am i doing wrong? or is this a bug?
Even with a hardcoded path in the Additional includes, the files are not found.
I am in Release mode. If i switch to Debug mode, some of the files are found, but some are not. The Additional includes seem to stay the same when I switch, this seems odd. (I have not added additional includes for Debug).
Thank you for your help, this is driving me mad.
Create a new folder named "include" in your project directory.
Right-click on the project and then on Properties.
CUDA C/C++ -> Additional Include Directories. Type into the upper half $(ProjectDir)include. it should evaluate this path correctly. Check that!
In your kernel.cu that includes your main-function, type in #include "include\mycode.cu". That worked for me. Good luck!

namespace boost has no member

I downloaded the latest version of Boost libraries 1_60_0 and I tried to use it but I quickly ran into troubles.
boost::unordered_map<int, int> map;
This piece of code says "namespace boost has no member unordered_map". I checkd the file, it is there though. The same happened for basically everything I tried to acces from the boost namespace.
Header includes are as follows:
#include <D:/IP/boost_1_60_0/boost/graph/adjacency_list.hpp>
#include <D:/IP/boost_1_60_0/boost/graph/graph_traits.hpp>
#include <D:/IP/boost_1_60_0/boost/graph/connected_components.hpp>
#include <D:/IP/boost_1_60_0/boost/unordered_map.hpp>
#include <D:/IP/boost_1_60_0/boost/graph/floyd_warshall_shortest.hpp>
#include <D:/IP/boost_1_60_0/boost/numeric/ublas/matrix.hpp>
#include <D:/IP/boost_1_60_0/boost/numeric/ublas/io.hpp>
I'm guessing I should include something more, but no clue what. Any tips?
unordered_map.hpp includes other boost header files this way:
#include <boost/config.hpp>
Which means that the boost folder has to be set as an additional include directory for this to work.
I'm assuming you're compiling on MSVC, if so, right click your project : properties -> C/C++ -> General and add the folder D:/IP/boost_1_60_0/ as Additional Include Directory.
The docs also answers this question for you.

Cannot #include freeglut of OpenGL in Visual Studio C++ 2013

I want to begin programming with C++ OpenGl, and thus have downloaded freeglut to be included in my programn.
I have defined statically FREEGLUT_STATIC
Here is my source.cpp:
#include <GL\glew.h>
#include <GL\GLU.h>
#include <GL\freeglut.h>
#include "Source.h"
using namespace std;
int main()
{
return 0;
}
source.h
#define FREEGLUT_STATIC
But it does not work, the error is:
1>LINK : fatal error LNK1104: cannot open file 'freeglut.lib'
It's worth mentioning that I have added the libraries directories to the project, and even when I type Gl/ visual studio 2013 automatically suggest the libraries and headers which means it knows the directory,
I have found the problem. I should simlpy do the following:
Right click on my project in Visual Studio, go to the properties, and then to VC++ Directories, click on "Library Directories" and then add a new path:
under the freeglut main directory in your hard drive, there is a folder called lib/x86/Debug, just add the full path and then apply that.
Your script should be executed properly.
The include works alright (otherwise you'd get an error at compile time, not at link time). The library file itself (freeglut.lib) seems to be missing. This SO question addreses your problem.
EDIT: Updated my answer because obviously just the binary for the lib is missing. Same link already given in a comment by swaldi.