I'm compiling my project with clang but I'm having an odd error:
[ 1%] Building CXX object CMakeFiles/tfs.dir/src/actions.cpp.o
In file included from /home/travis/build/dominique120/miniature-adventure/src/actions.cpp:20:
In file included from /home/travis/build/dominique120/miniature-adventure/src/otpch.h:27:
/home/travis/build/dominique120/miniature-adventure/src/definitions.h:39:10: fatal error:
'cmath' file not found
#include <cmath>
^
make: *** [all] Error 2
My actions.cpp line 20:
#include "otpch.h"
otpch.h line 27:
#include "definitions.h"
definitions.h line 31:
#include <cmath>
I made a few edits but I have no idea what is causing this error, edits here: https://github.com/dominique120/miniature-adventure/commits/master
PS: GCC just dumps a ton of errors:
https://travis-ci.org/dominique120/miniature-adventure/jobs/21905513
After googling for a problem I was having on macOS, I came to your post. I am sharing a solution, even though it applies only to Mac users.
Chances are you upgraded Xcode (or it was upgraded for you) and you continue to use an old compilation scheme.
Determine which of the following directories actually exists on your disk:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/
and make sure that among your compilation switches you have -I along with a directory that exists.
I had the same issue on Ubuntu 22.04 with libstdc++-11-dev installed.
After doing:
sudo apt install libstdc++-12-dev
...the error went away.
It seems to occur with libstdc++-11 only?
Related
I am running a fresh install of Linux Mint 20.1 and I'n trying to compile a program for a GPS tracker, but it won't compile:
In file included from /usr/include/c++/9/bits/stl_algo.h:59,
from /usr/include/c++/9/algorithm:62,
from /usr/include/x86_64-linux-gnu/qt5/QtCore/qglobal.h:142,
from /usr/include/x86_64-linux-gnu/qt5/QtCore/QtCore:4,
from pch.h:27:
/usr/include/c++/9/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
75 | #include_next <stdlib.h>
| ^~~~~~~~~~
compilation terminated.
I have installed a number of additional libraries (libusb, libmarble and a few others) and qmake.
Of course, stdlib.h is present on the system:
$ find /usr -name stdlib.h
/usr/include/x86_64-linux-gnu/bits/stdlib.h
/usr/include/bsd/stdlib.h
/usr/include/stdlib.h
/usr/include/c++/9/tr1/stdlib.h
/usr/include/c++/9/stdlib.h
/usr/include/tcl8.6/tcl-private/compat/stdlib.h
After looking at the other questions about this, I re-installed build-essential, which didn't help.
I re-installed the g++ compiler, no luck either.
I copied /usr/include/c++/9/stdlib.h to /usr/local/include, but it still complains about a missing stdlib.h
I changed the
#include_next <stdlib.h>
in cstdlib into
#include <stdlib.h>
only to find that the next include cannot find stdlib.h; changing that one produced the third include and so on. So that does not work either.
The program compiles and works on Slackware 14.2 by the way.
What am I missing?
Hello-world compiles normally; a simple program that does a malloc also compiles and runs.
I used to #anastaciu 's solution.
As it was a fresh install without much customization, I resorted to the option of a complete re-install. Bizarre that that works a bit, as it was already a fresh install. I still had to copy stdlib.h and a few others (math.h etc.) to /usr/local/lib` to get to the point where it would at least compile.
In my environment, I couldn't include <cstring>.
My g++ version is 4.9.3 (Homebrew gcc49 4.9.3).
The error is:
- /usr/local/Cellar/gcc49/4.9.3/include/c++/4.9.3/cstring:42:20: fatal
error: string.h: No such file or directory
"#include string.h"
But, in another environment (g++ 4.8.4[Ubuntu 4.8.4-2ubuntu1~14.04.3]), I can include <cstring> and run.
What's the problem and how do I solve it?
[P.S.]
Maybe, I misunderstood about the problem.
I tried to run my previous code, but got an error like this:
/usr/local/Cellar/gcc49/4.9.3/include/c++/4.9.3/cassert:43:20: fatal error: assert.h: No such file or directory
#include <assert.h>
Then, I can't run my code.
It is a g++'s problem.
I checked this article, but this procedure is not working.
I already installed xcode-select (commmad line tool) and I uninstalled xcode-select and reinstalled xcode-select, but it's not working.
Building C++ not working in OSX 10.9
Reinstalling the heaaders fixed my issue:
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
I am extending a project which includes cppdb/frontend.h, but when I compile I always have this compilation error.
graph_from_db.cpp:6:28: fatal error: cppdb/frontend.h: No such file or directory
#include <cppdb/frontend.h>
^
compilation terminated.
I tried to install libcppdb0 in my Kubuntu 14.04 but it gives this error
E: Package 'libcppdb0' has no installation candidate.
What could be the best way to include this package or file to the project?
I am using a 32bit HP computer with i386 architecture. I have been on this for two weeks now no solution.
I know this is not the new issues, and i had do all the research check you any possible solution match my problem. Unfortunately, i couldn't found any.
Im using Mac Yosemite 10.10, Netbean 8.0 compiling an cpp project code. I notice my issues was during compiling the system will look for omp.h at
/usr/local/Cellar/libiomp/20150401/include/libiomp/omp.h
However, error was show the omp.h not found
In file included from <built-in>:339:
In file included from <command line>:4:
./predict_common.h:25:10: fatal error: 'omp.h' file not found
#include <omp.h>
^
1 error generated.
make[2]: *** [build/Debug/GNU-MacOSX/build_vocabolary.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
Note: This also some warning (yellow underline) at the code that #include not found.
My previous solutions was
1) Copy the omp.h file to /usr/include/ .since i notice the Netbeans was looking header files at this location. So at programming code, yellow underline was gone.
However, during compilation, system found both omp.h in different location and shown cogflict errors.
2) Remind omp.h file at /usr/include/ and remove the one at /usr/local/Cellar/libiomp/20150401/include/libiomp/omp.h
Funny was, during half way of compiling, system show error omp.h file not found at
/usr/local/Cellar/libiomp/20150401/include/libiomp/omp.h location!
I was wonder do I miss out to set PATH? what should i do and any setting need to me done in Netbeans ? Please assist..Thanks
In project properties under Build -> C Compiler edit the include directories textfield and add the directory containing that header file.
You should delete the extra copy you put in /usr/include to avoid conflicts.
The Solutions
Right click at Projectname -> Propertise -> C compiler
at
1) Include Directories -> add
/usr/local/Cellar/libiomp/20150401/include/libiomp/
*Note: at terminal check where is omp.h located by
$locate omp.h
Although it listed more than one location, but you should identify when you install clang-omp where might same location.
2) Include Header ->
omp.h
For the above solutions, it works for me.
When trying to make GLEW with MSYS, I'm getting the following error:
In file included from src/glew.c:37:0:
include/GL/glxew.h:97:22: fatal error: X11/Xlib.h: No such file or directory
#include <X11/Xlib.h>
compilation terminated.
make: *** [tmp/mingw/default/shared/glew.o] Error 1
Why?
MSYS does not have X11. It's *M*inimal SYStem for a reason. You want Cygwin.
Or if you want to keep things Win32 native without Cygwin, take a look at Xming.