Boost "no such file or directory" - c++

I'm trying to set up my Code::Blocks work environment on a new computer and I'm having some problems. It's been a long time since I first did this, and now when I open my major project Boost is causing me problems.
I'm fairly new to C++ still and fixing this type of problem is something I have limited experience with.
When I open my project and try to compile it, I get this error:
fatal error: boost/algorithm/string.hpp: No such file or directory|
At this part of one of my header files:
#include <boost/algorithm/string.hpp>
I placed the Boost v1.51.0 library at C:\boost since that is where I'd had it on my other computer. My project is set to search that directory for additional includes but it doesn't seem to be finding the files?
My project used an older version of Boost previously but I doubt that's an issue.
I'm not sure how difficult it is to debug this problem with this limited information so if there's anything else I can provide please let me know.
I'm using Code::Blocks, and have just set up minGW and Visual C++ 2010.

In Ubuntu use
sudo apt-get install libboost-dev

Ensure that you have installed boost-devel package
In Centos execute as root:
yum install boost-devel
then
root#centos6 /]# find / -name boost
/usr/include/boost
/usr/lib64/boost
[root#centos6 /]#

Related

Can't build with libusb. ‘_Atomic’ does not name a type

I am attempting to use libusb for a project and my C++ is rusty. I think I've resolved the dependencies for libtool and libdev on my ubuntu box, but now when I run, I get the following error.
/usr/lib/gcc/x86_64-linux-gnu/10/include/stdatomic.h:40:9: error: ‘_Atomic’ does not name a type
I found How to include C11 headers when compiling C++ with GCC?, but not sure how this helps me.
The problem appears to be in gcc somehow, but not sure how to go about fixing it. I'm using C++ 20 in CLion.
I'm running on Ubuntu and I had tried
sudo apt install libusb
to no avail. On a hunch I tried
sudo apt install libusb-dev
And it worked, so now I don't need to build it.
I need to remember to search for the library name if it isn't obvious.

Building C++ not working in OSX 10.9

Update:
I solved the problem in the end by reinstalling command line tools, as shown in this link.
Sorry for the trouble!
Initial question
I have just upgraded to OSX Mavericks and I cannot make the compiler work anymore.
I've been using gcc48 from macports with vim/sb2 and everything was working just fine. Now any library that I include gives tons of errors. I am not very experienced and I do not know what to do, or what to search for. I just want it to work like before. Here is what is says when compiling a basic "hello world" program:
In file included from /opt/local/include/gcc48/c++/bits/postypes.h:40:0,
from /opt/local/include/gcc48/c++/iosfwd:40,
from /opt/local/include/gcc48/c++/ios:38,
from /opt/local/include/gcc48/c++/ostream:38,
from /opt/local/include/gcc48/c++/iostream:39,
from ceva.cpp:1:
/opt/local/include/gcc48/c++/cwchar:44:19: fatal error: wchar.h: No such file or directory
#include <wchar.h>
If you need any information, tell me and I will provide it to you. Thank you for your patience!
[Added 2019 - Mojave/Catalina] XCode 10 has removed the placement of headers in /usr/include, even with the command line tools. If you want headers, and you're on you should be able to install a transitional package, which is available on Mojave. This package is not present on the Catalina. The headers are within the SDK for the appropriate release.
XCode 5/Mavericks have changed the defaults for where headers are located.
On prior versions of Mac OS X / XCode you would have found headers in /usr/include.
When you built gcc on the older release it picked up the headers from that location, and looks for them there now when you try to build code.
The problem is that the files are not there; they're somewhere under /Applications/Xcode.app/Contents/Developer.
You could futz about with a spec file to get it working consistently again, but the sanest thing to do is rebuild gcc.
As has been mentioned as well, you can install the command line tools using xcode-select --install, which will reinstall the developer tools, including the headers in /usr/include.
I tend to reinstall things like gcc when I upgrade my operating system as I encounter other errors due to changes in the environment. This is just a habit I've formed. It may not be the best habit, but it's saved me pain on numerous occasions.
[added 2017] As an addendum, if you install the command line tools, then the headers will be placed in /usr/include as well. The command to install the command line tools is xcode-select --install - this will allow you to use most compilers without having to specify the location of the headers manually.
This is how I got it working on Mac osx Mavericks:
Open terminal
type --> xcode-select --install
A pop-up windows will apear asking you about install tools
choose install tools
wait install to finish
Here is a manual method for updating XCode on OS X Mavericks:
Go into the developers site http://developer.apple.com
Then go to Downloads for Apple developers and there is a command line tools installer for Mavericks — here's the link (but you'll need a developers account for the link to work) http://developer.apple.com/downloads/index.action?q=xcode
I'm using MacOs Sierra 10.12.4, got the same problem.
I solved it by using:
/usr/bin/gcc
For me the fix was to uninstall old broken gcc:
brew uninstall gcc#5
I noticed paths like /usr/local/Cellar/gcc#5 in build output, while gcc#8 was also installed and is the one that was supposed to be used.

Error: boost/scoped_ptr.hpp: No such file or directory while using libkml

I am developing a software which uses Google Map database. I searched google and I found a library in C++ can do that - libkml. I've downloaded some examples code in this website, but when I compiled with this command: g++ main.cpp -lkml, it occured an error:
fatal error: boost/scoped_ptr.hpp: No such file or directory
What is "boost/scoped_ptr.hpp"? I try finding this file in terminal
locate boost/scoped_ptr.hpp
but there's nothing.
You need to install the boost libraries from http://www.boost.org/
Depending on your OS there will be pre-built solutions that you can install. For example on Ubuntu you can do sudo apt-get install libboost-all-dev. On Mac see this thread Boost: MacOSX binaries for Boost
On Windows this may help: http://boost.teeks99.com/

Unresolved <iostream> in Eclipse, Ubuntu

Yes, it's this question again...
Somehow, I cannot get this issue resolved. Believe it or not, I have experience with Eclipse but only for Java development. I have programmed in C++ using vi but not with Eclipse.
I have installed:
Ubuntu 12.04
Eclipse 3.7.2
GCC 4.6.3
Eclipse CDT 8.0.2
I created an empty Makefile project and selected the Linux GNU Toolchain:
I get the standard Unresolved inclusion <iostream> error, and I have some references to various "include" directories in the project:
I did notice that, while my "Paths and Symbols" setting for GNU C contains various paths, the same setting for GNU C++ is empty:
Also, I have the "GNU Elf Parser" under my C/C++ build settings:
What am I doing wrong here?
Cheers
Edit:
Here's an updated photo of my a project's build path that is working correctly:
The reason is that Eclipse simply cannot import a proper header. C++ iostream header in Ubuntu can be found:
$: sudo find / -name iostream
/home/beniamin/QtSDK/Madde/toolchains/arm-2009q3-67-arm-none-linux-gnueabi-x86_64-unknown-linux-gnu/arm-2009q3-67/arm-none-linux-gnueabi/include/c++/4.4.1/iostream
/home/beniamin/QtSDK/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/usr/include/c++/4.4/iostream
/usr/share/gccxml-0.9/GCC/2.95/iostream
/usr/include/c++/4.6/iostream
/usr/include/boost/tr1/tr1/iostream
So basically, I suppose the one you are looking for is /usr/include/c++/4.6/iostream, so you should in some place include this directory.
Edit: You should also have installed g++, or simply install build-essential package, which is obligatory for building debian packages. Nevertheless, g++ should have been included in your Ubuntu installation anyway.
Yes, I have found that using
$: sudo find / -name iostream
and adding the includes file in the includes path and then it success.

getting Boost working in centos 5.5

This sounds like it should be simple, but it is proving to be impossible to accomplish.
I installed with the following command:
sudo yum install boost boost-devel boost-doc
Then, I started to added the following to my header file
#include <boost/filesystem.hpp>
and I promptly got the following error:
error: boost/filesystem.hpp: No such file or directory
I know that boost is partially working because when I use this header:
#include <boost/lambda/lambda.hpp>
i don't get compilation issues.
I know that I need to somehow build certain libraries like filesystem
However, I have not been able to find instructions anywhere on the entire internet for how to do this for CentOS 5. There is no bootstrap.sh or ./bjam for me to use.
I just looked at the RHEL 5.5 RPM for boost-devel, and it is missing /usr/include/boost/filesystem.hpp. The RPMs have Boost 1.33.1, and that version did not have boost/filesystem.hpp in it. You should upgrade to a newer version of Boost or write your code using the documentation for Boost 1.33.1 (available at http://www.boost.org/doc/libs/1_33_1/libs/filesystem/doc/index.htm).