Fatal error comp.h not found Netbean 8.0 - c++

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.

Related

Atom searching in wrong directory for c++ file for compilation, does anyone know how to fix it?

I have just downloaded and tested the MinGW's c++ compiler. In the terminal it works fine. Then I went to atom, downloaded gpp-compiler and tried compiling the same document I had compiled in the terminal. On atom however, I got this message:
g++: error: /mnt/c/Users/phfer/Desktop/cpp/new.cpp: No such file or directory
g++: fatal error: no input files
compilation terminated.
As you can see, atom is searching for the file new.cpp in the directory /mnt/c/, instead of searching for it in C:\Users...
Does anyone know how to fix this?

CMake fails on Mac [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am running a C++ program to test code in my C++ project. I have successfully run it using Eclipse. However, when I try to build it using CMake (for automated testing) it hits the following issue:
The cmake command resolves without problems, but when I run make, it fails with errors of the following three categories:
In file included from /Users/douglas/Desktop/automatedTesting/src/main.cpp:9:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iostream:38:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ios:216:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__locale:15:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:470:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string_view:169:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__string:56:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:641:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:61:
In file included from /Users/douglas/Desktop/automatedTesting/src/string.h:6:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/sstream:174:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ostream:139:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/streambuf:139:5: error:
unknown type name 'locale'
Along with ‘locale’ the same issue occurs with ‘streamsize’
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/streambuf:155:41: error:
incomplete type 'std::__1::ios_base' named in nested name specifier
And lastly:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:98:24: note:
forward declaration of 'std::__1::ios_base'
These errors are repeated multiple times until a total of 20 are generated, at which point it gives the following final output:
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [CMakeFiles/makeTest.dir/src/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/makeTest.dir/all] Error 2
make: *** [all] Error 2
My CMakeLists.txt is the following:
cmake_minimum_required (VERSION 2.6)
project(makeTest)
set (makeTest_VERSION_MAJOR 1)
set (makeTest_VERSION_MINOR 0)
add_executable(makeTest src/main.cpp serial-messenger/forTest.cpp src/String.cpp src/parson.c)
target_include_directories(makeTest PRIVATE src)
target_include_directories(makeTest PRIVATE serial-messenger)
Environment details:
OS: Mac OS High Sierra version 10.13.4
CMake: 3.13.0
CLANG: Apple LLVM version 9.1.0 (clang-902.0.39.2)
XCode is installed
I'm sure I must have made some error with setting up the environment for CMake, but I have no idea what it might be.
Edit: it looks like since Macs are case insensitive, it is mistaking my String.h file for string.h, causing the problem.
Edit 2: The problem was indeed due to Mac being case insensitive. Running it on a case sensitive OS like Linux resolves the issue.
Never give a standard name to a header with custom functionality!
Changing only a case (lower to upper or vice versa) isn't a good idea too.
According to the include chain in the error message, the system header file
.../usr/include/c++/v1/cstring
actually includes a custom one
.../automatedTesting/src/string.h
This is because you give a standard name string.h to your custom header. (Well, the actual name of the file is String.h, but MacOS uses a case-insensitive filesystem). And this is a real problem: the system header expects to obtain some standard definitions with such include, but the custom header doesn't provide them.
Rename your custom header to the non-standard name (e.g., mystring.h) and adjust your #include directives accordingly.

How to get an appropriate C++ for compiling CMAKE

I use MinGW64+msys on Winodws7 64bit
Now I’m trying to build CMAKE but I can’t.
When I typed ./configure soon an error happened. .
---------------------------------------------
CMake 3.2.3, Copyright 2000-2015 Kitware, Inc.
Found GNU toolchain
C compiler on this system is: gcc
---------------------------------------------
Error when bootstrapping CMake:
Cannot find appropriate C++ compiler on this system.
Please specify one using environment variable CXX.
See cmake_bootstrap.log for compilers attempted.
I also find error messages in Bootstrap.cmk/cmake_bootstrap.log like bellow.
[First Message in the log file]
In file included from c:/mingw64/x86_64-w64-mingw32/include/c++/iosfwd:40:0,^M
from c:/mingw64/x86_64-w64-mingw32/include/c++/ios:38,^M
from c:/mingw64/x86_64-w64-mingw32/include/c++/ostream:38,^M
from c:/mingw64/x86_64-w64-mingw32/include/c++/iostream:39,^M
from cmake_bootstrap_4468_test.cxx:3:^M
c:/mingw64/x86_64-w64-mingw32/include/c++/bits/postypes.h:40:35: fatal error: cw
char: No such file or directory^M
compilation terminated.^M
[Second Message in the log file]
cmake_bootstrap_4468_test.cxx:5:23: fatal error: iostream.h: No such file or dir
ectory^M
compilation terminated.^M
Test failed to compile
They said cwchar and iostream.h doesn't exist, although I have them and set their path to environmental variable.
The first massage said my C++ compiler isn’t appropriate. I installed it by mingw-get.exe.
Does anyone know, how can I get appropriate C++ compiler?
You mixed two compilers. I recommend: delete your old one and install msys2+mingw64.

QuantLib 1.5 compiling error cannot open file 'QuantLib-vc100-x64-mt.lib'

I have already installed boost library v1.57.0 (x64) via the binary file, which works properly under my VS2010Pro.
However, when I tried to compile the latest version (v1.5) of QuantLib, by opening QuantLib_vc10.sln file, for both 'Debug' and 'Release' under 'x64' in VS2010, I got something like:
QuantLib.vcxproj -> ...\QuantLib-1.5.\lib\QuantLib--x64-mt.lib
in the 1st project, then 18 failed build with the error:
LINK : fatal error LNK1104: cannot open file 'QuantLib-vc100-x64-mt.lib'
It is clear that the fatal error is due to the incapability of naming library with 'vc100' in the 1st project. But I don't know how to fix the problem.
Any suggestions? Thanks!
The version tag should be taken care of in the QuantLib.props file, which in imported in the project. From searching a bit, though, it looks like the VisualStudioVersion property (which we're relying on) might not be defined in VS10. Try editing QuantLib.props, and adding
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
</PropertyGroup>
before the other two PropertyGroups, and relinking the library (and please, let me know if this works so I can patch the file in the next release).

Clang: 'cmath' file not found

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?