Cmath Errors Using FLTK

For some reason, when I add the FLTK directory to my inclusion path, I get a bunch of errors from cmath. I am using GCC version 4.2. Here is an example program and assembly output:

main.cpp

#include <cmath>

int main()
{
    return 0;
}

**** Build of configuration Debug for project CMath Test ****

make -k all 
Building file: ../main.cpp
Invoking: GCC C++ Compiler
g++ -I/usr/include/FL -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" -o"main.o" "../main.cpp"
In file included from ../main.cpp:1:
/usr/include/c++/4.2/cmath:100: error: โ€˜::acosโ€™ has not been declared
/usr/include/c++/4.2/cmath:116: error: โ€˜::asinโ€™ has not been declared
/usr/include/c++/4.2/cmath:132: error: โ€˜::atanโ€™ has not been declared
/usr/include/c++/4.2/cmath:148: error: โ€˜::atan2โ€™ has not been declared
/usr/include/c++/4.2/cmath:165: error: โ€˜::ceilโ€™ has not been declared
/usr/include/c++/4.2/cmath:181: error: โ€˜::cosโ€™ has not been declared
/usr/include/c++/4.2/cmath:197: error: โ€˜::coshโ€™ has not been declared
/usr/include/c++/4.2/cmath:213: error: โ€˜::expโ€™ has not been declared
/usr/include/c++/4.2/cmath:229: error: โ€˜::fabsโ€™ has not been declared
/usr/include/c++/4.2/cmath:245: error: โ€˜::floorโ€™ has not been declared
/usr/include/c++/4.2/cmath:261: error: โ€˜::fmodโ€™ has not been declared
/usr/include/c++/4.2/cmath:271: error: โ€˜::frexpโ€™ has not been declared
/usr/include/c++/4.2/cmath:287: error: โ€˜::ldexpโ€™ has not been declared
/usr/include/c++/4.2/cmath:303: error: โ€˜::logโ€™ has not been declared
/usr/include/c++/4.2/cmath:319: error: โ€˜::log10โ€™ has not been declared
/usr/include/c++/4.2/cmath:335: error: โ€˜::modfโ€™ has not been declared
/usr/include/c++/4.2/cmath:354: error: โ€˜::powโ€™ has not been declared
/usr/include/c++/4.2/cmath:376: error: โ€˜::sinโ€™ has not been declared
/usr/include/c++/4.2/cmath:392: error: โ€˜::sinhโ€™ has not been declared
/usr/include/c++/4.2/cmath:408: error: โ€˜::sqrtโ€™ has not been declared
/usr/include/c++/4.2/cmath:424: error: โ€˜::tanโ€™ has not been declared
/usr/include/c++/4.2/cmath:440: error: โ€˜::tanhโ€™ has not been declared
make: *** [main.o] Error 1
make: Target `all' not remade because of errors.
Build complete for project CMath Test

g++ -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7)

Can someone tell me what happened? Thanks!

+3
source share
4 answers

Pure spec, but is there a 'math.h' header in /usr/include/FL, if possible? Or is there some other header that is included cmath?

[... a little time passes ...]

, ", , ?", , /usr/include "math.h", GCC (g++), , ''. , - /usr/include - .

[... ...]

, ... , , math.h, .

, . -, , FLTK: <FL/header.h> <header.h> ? , -I/usr/include/FL ; <FL/header.h> ( /usr/include/FL/header.h /usr/include - , <sys/types.h> /usr/include).

, :

-I/usr/include -I/usr/include/FL

" /usr/include /usr/include/FL ( /usr/include /usr/include/FL)". , , /usr/include/FL/math.h. , .

+3

. math.h include Qt Creator, , math.h. , find / -name math.h. , , .

+4

, -lm , .

0

Qt Creator 3.3.0

, ,

#include <cmath>

on the top line before other #includes

He solves my problems !!!

0
source

Source: https://habr.com/ru/post/1717891/


All Articles