Cannot include a header in MinGW - c++

I'm using SublimeText with MinGW on Windows 7 an wanted to include
#include <boost/multiprecision/cpp_int.hpp>
but I get
fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
#include <boost/multiprecision/cpp_int.hpp>
Couldn't figure out what to do from what I've found here and in Google.
This is the path to the include folder:
C:\MinGW\include\
Should I add something like? (from what I could "understand")
-I C:/MinGW/include/boost
But it doesn't work...

you need to install boost (from boost.org). http://www.boost.org/users/history/version_1_57_0.html
your #include already starts with boost/ so it will look in include/boost.

UPDATE:
"-IC:/MinGW/include"
Oh okay, I figured it out.
So... I have all the necessary libraries here C:\MinGW\include\
But in order to be able to include boost files (C:\MinGW\include\boost) I needed to copy this folder here C:\MinGW\include\c++\4.9.1 which is where MinGW was looking for my files...
So in the end I get C:\MinGW\include\c++\4.9.1\boost with all the necessary libraries inside. Now it works.

Related

boost program options config.hpp not found, Mac Xcode 8.3

Trying to compile simple example program with boost::program_options. The suggested include directive for the lib is
#include <boost/program_options.hpp>
I noticed the hard path to boost/program_options.hpp (relative to root folder) is:
boost/libs/program_options/include/boost/program_options.hpp.
And the symlinked path from the root folder boost/program_options/ points to hard path:
boost/libs/program_options/include/boost/program_options/
which is one level below the program_options.hpp file.
I assume I should set my header search path in Xcode to
boost/libs/program_options/include/
and not at boost root?
If I do the former, I get no errors in editor, and auto-completion works, but when I go to compile I get error:
fatal error: 'boost/config.hpp' file not found
#include <boost/config.hpp>
Any advice on how to include this? Have used 1/2-dozen other boost libs without problem.
UPDATE
Sorry, I missed that this lib was NOT header-only.
On building with the program_options lib, it's working fine.

Trying to include boost serialization in project

I added -lboost_serialization in the makefile:
This is what I include in the main to use boost:
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/serialization/binary_object.hpp>
#include <boost/archive/polymorphic_binary_iarchive.hpp>
#include <boost/archive/polymorphic_binary_oarchive.hpp>
when I compile I don't get errors but when I run the program I get this error message:
"./Project: error while loading shared libraries: libboost_serialization.so.1.63.0: cannot open shared object file: No such file or directory"
what should I do to fix this?
When this happens you most likely need to adapt your LD_LIBRARY_PATH. As you need to load shared library, and they are placed at some unusual place, you need to specifiy where they can be found when your program is executed.
I guess in your case they cannot be found in the folder /usr/lib but at some other place, then just add this folder to the mentionned environment variable, using
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/some/new/path
And then start your program as usually.
The path /some/new/path is the path where the file libboost_serialization.so is located.
I had the same problem when I tried to run some script and add the LD_LIBRARY_PATH didn't work... so I simply copied the ".so" file to /usr/lib and it worked perfectly.

eclipse-cdt boost\shared_ptr.hpp: no such file in directory, but its part of the include files

I'm new to using MySQL and Boost, and the Q&A in this site have been really helpful so far. However, I have not been able to resolve the following problem. I am using the 'complete example 1' from the 'mysql connector/c++ developer guide'(as a test). Though I have included the boost files in my project I still get the following fatal error: boost/shared_ptr.hpp: No such file or directory
but the this file is in the boost folder. Have I missed out something I should have done?
I have linked a screenshot of my eclipse-cdt showing the error and the missing header file on the left.
even though mysql_connection.h header file has 2 include lines,
#include <boost/shared_ptr.hpp>
#include <boost/scoped_ptr.hpp>
only one of them show up as an error.
https://drive.google.com/open?id=0BxPDShOqHnvvNERua0NRcTk2Vzg
Your help is much appreciated. Thank you
I just had to change the include folder for boost from
C:\boost_1_63_0\boost to
C:\boost_1_63_0
as the code was looking inside the boost folder.

Include statement: can't find SDL/SDL.h file

My understanding is that when I build a C++ project in xcode and I have an include line in one of my C files in angle-bracket form then the C++ compiler that works with xcode looks in /System/Library/Frameworks/ to find the file. I think that because of this answer: when I use the line #include <OpenGL/gl.h> in my xcode project, where does it look for the gl.h file?
I have an SDL.h file at /System/Library/Frameworks/SDL.framework/headers/SDL.h (I downloaded the folder SDL.framework and copied it to that location with the command sudo cp -r /Volumes/SDL/SDL.framework System/Library/Frameworks)
But my include statement in one of the files in my xcode project still gives this error:
#include <SDL/SDL.h> //throws file not found
Did I properly install the SDL framework? Why doesn't xcode see it?
Under your projects Build Settings, do a search for "search". Add a header search path to the SDL directory /System/Library/Frameworks/SDL.framework/headers
Should be able to just do this after:
#include <SDL.h>
Hope that works for you.
You can also check out this link:
http://meandmark.com/blog/2012/01/using-sdl-with-xcode-4/
It's for Xcode 4, but it looks like all the pieces are there.

Xcode Error - No such file or directory

I'm trying to build a project of mine that includes fuzzylite C++ libraries within a Carbon C++ application. However the compiler throws out an error for each fuzzylite's library I include in my source code. I've tried to include the Header Search Path and the Library Search Path on my target application build info but it doesn't work.
I've included the header file using double quote markers just like the following example:
#include "fuzzylite/test.h"
How can I include such library in my project and get it to work properly?
Easy, you need clean the path: #include "fuzzylite/test.h" for ALL #include, like this: #include "test.h"
From version 3.1, you should use #include fl/Headers.h.
If you are running into problems, I strongly encourage you to report the problem in the forums at http://www.fuzzylite.com, where I and others will be very happy to help you.