-1

I want to use <cmath>. If I do:

#include <cmath> 

I get the error message:

"In File included from"

However, when I type <cma and do ctrl+spacebar (in Netbeans) it shows me all the files available and cmath is listed (its in /usr/include/c++/4.7). I dont understand why the GUI editor/intellisense knows the cmath header exists, but I have the error "In File included from"?

Full error message:

In file included from /usr/include/c++/4.7/cmath:46:0,
                 from ../../Documents/FD/MyFile.h:4,
                 from ../../Documents/FD/MyFIle.cpp:1:
/opt/intel/include/math.h:27:3: error: #error "This Intel <math.h> is for use with only the Intel compilers!"
make[2]: *** [build/Debug/GNU-Linux-x86/_ext/2009285305/MyFile.o] Error 1
make[2]: Leaving directory `/home/me/NetBeansProjects/Project'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/home/me/NetBeansProjects/Project'

These are my include directories:

/opt/intel/include;

/usr/include/boost;

/usr/include

EDIT (For Chris):

#ifndef MYFILE_H
#define MYFILE_H

#include <cmath>


class MyFile{
    public:
        static double doesntmatter(double x, int y, double z);

    private:
};

#endif
7
  • 3
    That's not a complete error message. It also applies to a specific area of code, which needs to be shown (preferably in the form of an SSCCE).
    – chris
    Nov 3, 2013 at 0:40
  • As you can see from my edit- there wasn't really much point in a SSCCE, as I had already mentioned the useful information in my post (the include directories I have etc). Nov 3, 2013 at 0:49
  • Have added the compile error - its something to do with the fact <cmath> uses math.h and Intel also have a math.h library Nov 3, 2013 at 0:52
  • 1
    Do not include the directory /opt/intel/include. It is for intel compilers, not gcc
    – Amadeus
    Nov 3, 2013 at 0:55
  • @TomásBadan I know that would fix it, but I want to use the Intel header <ia32intrinsic.h> in my project? Nov 3, 2013 at 0:55

1 Answer 1

1

Netbeans is aware of several standard library headers, but this does not guarantee that your path has been correctly configured. Check to insure that your path is correctly configured, and that you are using the correct toolchain.

Without a more detailed error message I can't tell you much more than that.

4
  • I am using GCC/G++ 4.7. Do you need to know anything else? Nov 3, 2013 at 0:50
  • You have the correct tools installed, but you need to be sure your IDE is configured properly. Have you followed these steps? netbeans.org/community/releases/73/…
    – awiebe
    Nov 3, 2013 at 0:52
  • Yeh Netbeans is definitely using 4.7 because I originally had 4.6 and when I selected c++11 I had compiler errors- but I don't anymore because I upgraded to g++ 4.7. Therefore its definitely g++ 4.7 which is configured. Nov 3, 2013 at 0:55
  • error: #error "This Intel <math.h> is for use with only the Intel compilers!" The compiler encountered an error because a symbol required for using math had not been defined #ifndef __THIS_IS_A_SYMBOL_THAT_SAYS_IM_AN_INTEL_MACHINE #error "This Intel <math.h> is for use with only the Intel compilers!" #endif Somehow you've managed to install a math header that doesn't think it's a math header for your machine. Or your netbeans is targeted at an architecture that is not intel, and you are not using the toolchain for that architecture.
    – awiebe
    Nov 3, 2013 at 1:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.