cmath: No such file or directory #include












0














I downloaded and try to installed the package "wfconvert" from this link . but I got some error.



here what I did:




  1. copy the wfconvert folder in root "/"


  2. cd /wfconvert/build/



    root@geant4:/wfconvert/build# cmake ..

    -- Current revision : 65 modified on 2013-01-16 22:14:53 +0330 (Wed, 16 Jan 2013)
    -- Found mpi.h and libraries. Check for working mpi compiler
    -- MPI is disabled
    -- Failed to link LAPACK, BLAS, ATLAS libraries with environments. Going to search standard paths.
    -- LAPACK_LIBRARIES=/usr/lib/liblapack.so
    -- BLAS_LIBRARIES=/usr/lib/libblas.so
    -- CXX compiler flags: -g -O3 -ftemplate-depth-60 -Drestrict=__restrict__ -funroll-all-loops -finline-limit=1000 -Wno-deprecated -mmmx -msse -msse2 -msse3 -fopenmp
    -- CC compiler flags: -O3 -Drestrict=__restrict__ -funroll-all-loops -finline-limit=1000 -std=gnu99 -fomit-frame-pointer -mmmx -msse -msse2 -msse3
    -- LIBXML2_INCLUDE_DIR=/usr/include/libxml2
    -- LIBXML2_LIBRARIES=/usr/lib/libxml2.so
    -- HDF5_INCLUDE_DIR=/usr/include
    -- HDF5_LIBRARIES=/usr/lib/libhdf5.so
    -- FFTW_INCLUDE_DIR=/usr/include
    -- FFTW_LIBRARIES=/usr/lib/libfftw3.so
    -- Ready to build qmcpack
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /wfconvert/build



  3. make command



    root@geant4:/wfconvert/build# make

    [ 1%] Building C object src/einspline/CMakeFiles/einspline.dir/bspline_create.c.o
    In file included from /wfconvert/src/einspline/bspline_base.h:24:0,
    from /wfconvert/src/einspline/bspline_create.h:24,
    from /wfconvert/src/einspline/bspline_create.c:21:
    /wfconvert/build/src/Common/config.h:65:17: fatal error: cmath: No such file or directory
    #include <cmath>
    ^
    compilation terminated.
    make[2]: *** [src/einspline/CMakeFiles/einspline.dir/bspline_create.c.o] Error 1
    make[1]: *** [src/einspline/CMakeFiles/einspline.dir/all] Error 2
    make: *** [all] Error 2



I don`t know what to do!

here is my cmath file list:



root@geant4:/# find -name cmath
./opt/root5.32.00/cint/cint/include/cmath
./app/gcc/4.8.0/include/c++/4.8.0/ext/cmath
./app/gcc/4.8.0/include/c++/4.8.0/cmath
./app/gcc/4.8.0/include/c++/4.8.0/tr1/cmath
./usr/include/boost/compatibility/cpp_c_headers/cmath
./usr/include/boost/tr1/tr1/cmath
./usr/include/c++/4.5/cmath
./usr/include/c++/4.5/tr1_impl/cmath
./usr/include/c++/4.5/tr1/cmath
./usr/include/c++/4.6/cmath
./usr/include/c++/4.6/tr1/cmath
./usr/share/gccxml-0.9/GCC/2.95/cmath
./gcc-build/gcc-4.8.0/stage1-i686-pc-linux-gnu/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/stage1-i686-pc-linux-gnu/libstdc++-v3/include/cmath
./gcc-build/gcc-4.8.0/stage1-i686-pc-linux-gnu/libstdc++-v3/include/tr1/cmath
./gcc-build/gcc-4.8.0/i686-pc-linux-gnu/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/i686-pc-linux-gnu/libstdc++-v3/include/cmath
./gcc-build/gcc-4.8.0/i686-pc-linux-gnu/libstdc++-v3/include/tr1/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/c/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/c_global/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/c_std/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/tr1/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/testsuite/26_numerics/headers/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath
./gcc-build/gcc-4.8.0/prev-i686-pc-linux-gnu/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/prev-i686-pc-linux-gnu/libstdc++-v3/include/cmath
./gcc-build/gcc-4.8.0/prev-i686-pc-linux-gnu/libstdc++-v3/include/tr1/cmath


and



root@geant4:/# uname -a
Linux geant4 3.0.0-32-generic-pae #51-Ubuntu SMP Thu Mar 21 16:09:48 UTC 2013 i686 i686 i386 GNU/Linux


Please help me.










share|improve this question
















bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 1




    Cross-posted stackoverflow.com/q/17147170/3701431
    – Sergiy Kolodyazhnyy
    Nov 6 '18 at 5:57










  • I’m voting to close: According to the related SO question, it looks like a bug in the downloaded source (wrong file extension of the source files). Moreover, the link to the source is dead as of now.
    – Melebius
    Dec 6 '18 at 7:18


















0














I downloaded and try to installed the package "wfconvert" from this link . but I got some error.



here what I did:




  1. copy the wfconvert folder in root "/"


  2. cd /wfconvert/build/



    root@geant4:/wfconvert/build# cmake ..

    -- Current revision : 65 modified on 2013-01-16 22:14:53 +0330 (Wed, 16 Jan 2013)
    -- Found mpi.h and libraries. Check for working mpi compiler
    -- MPI is disabled
    -- Failed to link LAPACK, BLAS, ATLAS libraries with environments. Going to search standard paths.
    -- LAPACK_LIBRARIES=/usr/lib/liblapack.so
    -- BLAS_LIBRARIES=/usr/lib/libblas.so
    -- CXX compiler flags: -g -O3 -ftemplate-depth-60 -Drestrict=__restrict__ -funroll-all-loops -finline-limit=1000 -Wno-deprecated -mmmx -msse -msse2 -msse3 -fopenmp
    -- CC compiler flags: -O3 -Drestrict=__restrict__ -funroll-all-loops -finline-limit=1000 -std=gnu99 -fomit-frame-pointer -mmmx -msse -msse2 -msse3
    -- LIBXML2_INCLUDE_DIR=/usr/include/libxml2
    -- LIBXML2_LIBRARIES=/usr/lib/libxml2.so
    -- HDF5_INCLUDE_DIR=/usr/include
    -- HDF5_LIBRARIES=/usr/lib/libhdf5.so
    -- FFTW_INCLUDE_DIR=/usr/include
    -- FFTW_LIBRARIES=/usr/lib/libfftw3.so
    -- Ready to build qmcpack
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /wfconvert/build



  3. make command



    root@geant4:/wfconvert/build# make

    [ 1%] Building C object src/einspline/CMakeFiles/einspline.dir/bspline_create.c.o
    In file included from /wfconvert/src/einspline/bspline_base.h:24:0,
    from /wfconvert/src/einspline/bspline_create.h:24,
    from /wfconvert/src/einspline/bspline_create.c:21:
    /wfconvert/build/src/Common/config.h:65:17: fatal error: cmath: No such file or directory
    #include <cmath>
    ^
    compilation terminated.
    make[2]: *** [src/einspline/CMakeFiles/einspline.dir/bspline_create.c.o] Error 1
    make[1]: *** [src/einspline/CMakeFiles/einspline.dir/all] Error 2
    make: *** [all] Error 2



I don`t know what to do!

here is my cmath file list:



root@geant4:/# find -name cmath
./opt/root5.32.00/cint/cint/include/cmath
./app/gcc/4.8.0/include/c++/4.8.0/ext/cmath
./app/gcc/4.8.0/include/c++/4.8.0/cmath
./app/gcc/4.8.0/include/c++/4.8.0/tr1/cmath
./usr/include/boost/compatibility/cpp_c_headers/cmath
./usr/include/boost/tr1/tr1/cmath
./usr/include/c++/4.5/cmath
./usr/include/c++/4.5/tr1_impl/cmath
./usr/include/c++/4.5/tr1/cmath
./usr/include/c++/4.6/cmath
./usr/include/c++/4.6/tr1/cmath
./usr/share/gccxml-0.9/GCC/2.95/cmath
./gcc-build/gcc-4.8.0/stage1-i686-pc-linux-gnu/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/stage1-i686-pc-linux-gnu/libstdc++-v3/include/cmath
./gcc-build/gcc-4.8.0/stage1-i686-pc-linux-gnu/libstdc++-v3/include/tr1/cmath
./gcc-build/gcc-4.8.0/i686-pc-linux-gnu/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/i686-pc-linux-gnu/libstdc++-v3/include/cmath
./gcc-build/gcc-4.8.0/i686-pc-linux-gnu/libstdc++-v3/include/tr1/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/c/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/c_global/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/c_std/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/tr1/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/testsuite/26_numerics/headers/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath
./gcc-build/gcc-4.8.0/prev-i686-pc-linux-gnu/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/prev-i686-pc-linux-gnu/libstdc++-v3/include/cmath
./gcc-build/gcc-4.8.0/prev-i686-pc-linux-gnu/libstdc++-v3/include/tr1/cmath


and



root@geant4:/# uname -a
Linux geant4 3.0.0-32-generic-pae #51-Ubuntu SMP Thu Mar 21 16:09:48 UTC 2013 i686 i686 i386 GNU/Linux


Please help me.










share|improve this question
















bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 1




    Cross-posted stackoverflow.com/q/17147170/3701431
    – Sergiy Kolodyazhnyy
    Nov 6 '18 at 5:57










  • I’m voting to close: According to the related SO question, it looks like a bug in the downloaded source (wrong file extension of the source files). Moreover, the link to the source is dead as of now.
    – Melebius
    Dec 6 '18 at 7:18
















0












0








0







I downloaded and try to installed the package "wfconvert" from this link . but I got some error.



here what I did:




  1. copy the wfconvert folder in root "/"


  2. cd /wfconvert/build/



    root@geant4:/wfconvert/build# cmake ..

    -- Current revision : 65 modified on 2013-01-16 22:14:53 +0330 (Wed, 16 Jan 2013)
    -- Found mpi.h and libraries. Check for working mpi compiler
    -- MPI is disabled
    -- Failed to link LAPACK, BLAS, ATLAS libraries with environments. Going to search standard paths.
    -- LAPACK_LIBRARIES=/usr/lib/liblapack.so
    -- BLAS_LIBRARIES=/usr/lib/libblas.so
    -- CXX compiler flags: -g -O3 -ftemplate-depth-60 -Drestrict=__restrict__ -funroll-all-loops -finline-limit=1000 -Wno-deprecated -mmmx -msse -msse2 -msse3 -fopenmp
    -- CC compiler flags: -O3 -Drestrict=__restrict__ -funroll-all-loops -finline-limit=1000 -std=gnu99 -fomit-frame-pointer -mmmx -msse -msse2 -msse3
    -- LIBXML2_INCLUDE_DIR=/usr/include/libxml2
    -- LIBXML2_LIBRARIES=/usr/lib/libxml2.so
    -- HDF5_INCLUDE_DIR=/usr/include
    -- HDF5_LIBRARIES=/usr/lib/libhdf5.so
    -- FFTW_INCLUDE_DIR=/usr/include
    -- FFTW_LIBRARIES=/usr/lib/libfftw3.so
    -- Ready to build qmcpack
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /wfconvert/build



  3. make command



    root@geant4:/wfconvert/build# make

    [ 1%] Building C object src/einspline/CMakeFiles/einspline.dir/bspline_create.c.o
    In file included from /wfconvert/src/einspline/bspline_base.h:24:0,
    from /wfconvert/src/einspline/bspline_create.h:24,
    from /wfconvert/src/einspline/bspline_create.c:21:
    /wfconvert/build/src/Common/config.h:65:17: fatal error: cmath: No such file or directory
    #include <cmath>
    ^
    compilation terminated.
    make[2]: *** [src/einspline/CMakeFiles/einspline.dir/bspline_create.c.o] Error 1
    make[1]: *** [src/einspline/CMakeFiles/einspline.dir/all] Error 2
    make: *** [all] Error 2



I don`t know what to do!

here is my cmath file list:



root@geant4:/# find -name cmath
./opt/root5.32.00/cint/cint/include/cmath
./app/gcc/4.8.0/include/c++/4.8.0/ext/cmath
./app/gcc/4.8.0/include/c++/4.8.0/cmath
./app/gcc/4.8.0/include/c++/4.8.0/tr1/cmath
./usr/include/boost/compatibility/cpp_c_headers/cmath
./usr/include/boost/tr1/tr1/cmath
./usr/include/c++/4.5/cmath
./usr/include/c++/4.5/tr1_impl/cmath
./usr/include/c++/4.5/tr1/cmath
./usr/include/c++/4.6/cmath
./usr/include/c++/4.6/tr1/cmath
./usr/share/gccxml-0.9/GCC/2.95/cmath
./gcc-build/gcc-4.8.0/stage1-i686-pc-linux-gnu/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/stage1-i686-pc-linux-gnu/libstdc++-v3/include/cmath
./gcc-build/gcc-4.8.0/stage1-i686-pc-linux-gnu/libstdc++-v3/include/tr1/cmath
./gcc-build/gcc-4.8.0/i686-pc-linux-gnu/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/i686-pc-linux-gnu/libstdc++-v3/include/cmath
./gcc-build/gcc-4.8.0/i686-pc-linux-gnu/libstdc++-v3/include/tr1/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/c/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/c_global/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/c_std/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/tr1/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/testsuite/26_numerics/headers/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath
./gcc-build/gcc-4.8.0/prev-i686-pc-linux-gnu/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/prev-i686-pc-linux-gnu/libstdc++-v3/include/cmath
./gcc-build/gcc-4.8.0/prev-i686-pc-linux-gnu/libstdc++-v3/include/tr1/cmath


and



root@geant4:/# uname -a
Linux geant4 3.0.0-32-generic-pae #51-Ubuntu SMP Thu Mar 21 16:09:48 UTC 2013 i686 i686 i386 GNU/Linux


Please help me.










share|improve this question















I downloaded and try to installed the package "wfconvert" from this link . but I got some error.



here what I did:




  1. copy the wfconvert folder in root "/"


  2. cd /wfconvert/build/



    root@geant4:/wfconvert/build# cmake ..

    -- Current revision : 65 modified on 2013-01-16 22:14:53 +0330 (Wed, 16 Jan 2013)
    -- Found mpi.h and libraries. Check for working mpi compiler
    -- MPI is disabled
    -- Failed to link LAPACK, BLAS, ATLAS libraries with environments. Going to search standard paths.
    -- LAPACK_LIBRARIES=/usr/lib/liblapack.so
    -- BLAS_LIBRARIES=/usr/lib/libblas.so
    -- CXX compiler flags: -g -O3 -ftemplate-depth-60 -Drestrict=__restrict__ -funroll-all-loops -finline-limit=1000 -Wno-deprecated -mmmx -msse -msse2 -msse3 -fopenmp
    -- CC compiler flags: -O3 -Drestrict=__restrict__ -funroll-all-loops -finline-limit=1000 -std=gnu99 -fomit-frame-pointer -mmmx -msse -msse2 -msse3
    -- LIBXML2_INCLUDE_DIR=/usr/include/libxml2
    -- LIBXML2_LIBRARIES=/usr/lib/libxml2.so
    -- HDF5_INCLUDE_DIR=/usr/include
    -- HDF5_LIBRARIES=/usr/lib/libhdf5.so
    -- FFTW_INCLUDE_DIR=/usr/include
    -- FFTW_LIBRARIES=/usr/lib/libfftw3.so
    -- Ready to build qmcpack
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /wfconvert/build



  3. make command



    root@geant4:/wfconvert/build# make

    [ 1%] Building C object src/einspline/CMakeFiles/einspline.dir/bspline_create.c.o
    In file included from /wfconvert/src/einspline/bspline_base.h:24:0,
    from /wfconvert/src/einspline/bspline_create.h:24,
    from /wfconvert/src/einspline/bspline_create.c:21:
    /wfconvert/build/src/Common/config.h:65:17: fatal error: cmath: No such file or directory
    #include <cmath>
    ^
    compilation terminated.
    make[2]: *** [src/einspline/CMakeFiles/einspline.dir/bspline_create.c.o] Error 1
    make[1]: *** [src/einspline/CMakeFiles/einspline.dir/all] Error 2
    make: *** [all] Error 2



I don`t know what to do!

here is my cmath file list:



root@geant4:/# find -name cmath
./opt/root5.32.00/cint/cint/include/cmath
./app/gcc/4.8.0/include/c++/4.8.0/ext/cmath
./app/gcc/4.8.0/include/c++/4.8.0/cmath
./app/gcc/4.8.0/include/c++/4.8.0/tr1/cmath
./usr/include/boost/compatibility/cpp_c_headers/cmath
./usr/include/boost/tr1/tr1/cmath
./usr/include/c++/4.5/cmath
./usr/include/c++/4.5/tr1_impl/cmath
./usr/include/c++/4.5/tr1/cmath
./usr/include/c++/4.6/cmath
./usr/include/c++/4.6/tr1/cmath
./usr/share/gccxml-0.9/GCC/2.95/cmath
./gcc-build/gcc-4.8.0/stage1-i686-pc-linux-gnu/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/stage1-i686-pc-linux-gnu/libstdc++-v3/include/cmath
./gcc-build/gcc-4.8.0/stage1-i686-pc-linux-gnu/libstdc++-v3/include/tr1/cmath
./gcc-build/gcc-4.8.0/i686-pc-linux-gnu/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/i686-pc-linux-gnu/libstdc++-v3/include/cmath
./gcc-build/gcc-4.8.0/i686-pc-linux-gnu/libstdc++-v3/include/tr1/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/c/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/c_global/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/c_std/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/tr1/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/testsuite/26_numerics/headers/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath
./gcc-build/gcc-4.8.0/prev-i686-pc-linux-gnu/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/prev-i686-pc-linux-gnu/libstdc++-v3/include/cmath
./gcc-build/gcc-4.8.0/prev-i686-pc-linux-gnu/libstdc++-v3/include/tr1/cmath


and



root@geant4:/# uname -a
Linux geant4 3.0.0-32-generic-pae #51-Ubuntu SMP Thu Mar 21 16:09:48 UTC 2013 i686 i686 i386 GNU/Linux


Please help me.







gcc






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 17 '17 at 17:08









Ravexina

31.6k1482111




31.6k1482111










asked Jun 17 '13 at 11:04









alireza yousefialireza yousefi

111




111





bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.










  • 1




    Cross-posted stackoverflow.com/q/17147170/3701431
    – Sergiy Kolodyazhnyy
    Nov 6 '18 at 5:57










  • I’m voting to close: According to the related SO question, it looks like a bug in the downloaded source (wrong file extension of the source files). Moreover, the link to the source is dead as of now.
    – Melebius
    Dec 6 '18 at 7:18
















  • 1




    Cross-posted stackoverflow.com/q/17147170/3701431
    – Sergiy Kolodyazhnyy
    Nov 6 '18 at 5:57










  • I’m voting to close: According to the related SO question, it looks like a bug in the downloaded source (wrong file extension of the source files). Moreover, the link to the source is dead as of now.
    – Melebius
    Dec 6 '18 at 7:18










1




1




Cross-posted stackoverflow.com/q/17147170/3701431
– Sergiy Kolodyazhnyy
Nov 6 '18 at 5:57




Cross-posted stackoverflow.com/q/17147170/3701431
– Sergiy Kolodyazhnyy
Nov 6 '18 at 5:57












I’m voting to close: According to the related SO question, it looks like a bug in the downloaded source (wrong file extension of the source files). Moreover, the link to the source is dead as of now.
– Melebius
Dec 6 '18 at 7:18






I’m voting to close: According to the related SO question, it looks like a bug in the downloaded source (wrong file extension of the source files). Moreover, the link to the source is dead as of now.
– Melebius
Dec 6 '18 at 7:18












3 Answers
3






active

oldest

votes


















0














I would suspect corrupt installation of development tools or something like that. First thing I would do is re install build package



sudo apt-get purge build-essential
sudo apt-get install build-essential


If the problem still persists post it back



Just curious: How did you install GCC 4.8? I have 13.04 and it have 4.7.3
So that might be an issue if was not done properly!






share|improve this answer





















  • I did your instruction but the problem did not solve. for installing gcc-4.8 refer to the link : askubuntu.com/questions/271388/…
    – alireza yousefi
    Jun 18 '13 at 7:41












  • Can you upload CmakeList.txt or screenshot of CMake GUI configurations? What happens if you cahnge line from <cmath> to <cmath.h>?
    – Stefano Mtangoo
    Jun 18 '13 at 11:51










  • download the CmakeList.txt , and when I replace the <cmath> with <cmath.h> the error remain the same.
    – alireza yousefi
    Jun 19 '13 at 10:40












  • To convert C++ sources to C (or ancient C++), <cmath> should be replaced with <math.h> (no c which denotes C standard libraries used in C++).
    – Melebius
    Dec 6 '18 at 7:22





















0














Is libm automatically linked too, while compiling ?



libm is for compiler g++ and is automatically linked. If you use gcc as compiler you need to link manually with math.h



I found this link here about different compilers generally :



https://stackoverflow.com/questions/1033898/why-do-you-have-to-link-the-math-library-in-c



By the way - there is http://boost.org



You could compile and include with boost-libraries too.






share|improve this answer























  • how can I linked manually to math.h
    – alireza yousefi
    Jun 18 '13 at 7:58










  • with gcc it looks this: gcc example.c -o example -lm for more precise compiling you do this: gcc -ggdb -Wall example.c -o example -lm
    – dschinn1001
    Jun 18 '13 at 17:19










  • with gcc it looks this: gcc example.c -o example -lm for more precise compiling you do this: gcc -ggdb -Wall example.c -o example -lm (provided - there is: #include <math.h> at the beginning of example.c)
    – dschinn1001
    Jun 18 '13 at 17:32



















0














With gcc it looks this:



gcc example.c -o example -lm   


for more precise compiling (with debugging output in case of failures) you do this:



gcc -ggdb -Wall example.c -o example -lm


lm is here the linking with the math-library of gcc (there is #include math.h at the beginning of example.c).






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f309195%2fcmath-no-such-file-or-directory-include-cmath%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I would suspect corrupt installation of development tools or something like that. First thing I would do is re install build package



    sudo apt-get purge build-essential
    sudo apt-get install build-essential


    If the problem still persists post it back



    Just curious: How did you install GCC 4.8? I have 13.04 and it have 4.7.3
    So that might be an issue if was not done properly!






    share|improve this answer





















    • I did your instruction but the problem did not solve. for installing gcc-4.8 refer to the link : askubuntu.com/questions/271388/…
      – alireza yousefi
      Jun 18 '13 at 7:41












    • Can you upload CmakeList.txt or screenshot of CMake GUI configurations? What happens if you cahnge line from <cmath> to <cmath.h>?
      – Stefano Mtangoo
      Jun 18 '13 at 11:51










    • download the CmakeList.txt , and when I replace the <cmath> with <cmath.h> the error remain the same.
      – alireza yousefi
      Jun 19 '13 at 10:40












    • To convert C++ sources to C (or ancient C++), <cmath> should be replaced with <math.h> (no c which denotes C standard libraries used in C++).
      – Melebius
      Dec 6 '18 at 7:22


















    0














    I would suspect corrupt installation of development tools or something like that. First thing I would do is re install build package



    sudo apt-get purge build-essential
    sudo apt-get install build-essential


    If the problem still persists post it back



    Just curious: How did you install GCC 4.8? I have 13.04 and it have 4.7.3
    So that might be an issue if was not done properly!






    share|improve this answer





















    • I did your instruction but the problem did not solve. for installing gcc-4.8 refer to the link : askubuntu.com/questions/271388/…
      – alireza yousefi
      Jun 18 '13 at 7:41












    • Can you upload CmakeList.txt or screenshot of CMake GUI configurations? What happens if you cahnge line from <cmath> to <cmath.h>?
      – Stefano Mtangoo
      Jun 18 '13 at 11:51










    • download the CmakeList.txt , and when I replace the <cmath> with <cmath.h> the error remain the same.
      – alireza yousefi
      Jun 19 '13 at 10:40












    • To convert C++ sources to C (or ancient C++), <cmath> should be replaced with <math.h> (no c which denotes C standard libraries used in C++).
      – Melebius
      Dec 6 '18 at 7:22
















    0












    0








    0






    I would suspect corrupt installation of development tools or something like that. First thing I would do is re install build package



    sudo apt-get purge build-essential
    sudo apt-get install build-essential


    If the problem still persists post it back



    Just curious: How did you install GCC 4.8? I have 13.04 and it have 4.7.3
    So that might be an issue if was not done properly!






    share|improve this answer












    I would suspect corrupt installation of development tools or something like that. First thing I would do is re install build package



    sudo apt-get purge build-essential
    sudo apt-get install build-essential


    If the problem still persists post it back



    Just curious: How did you install GCC 4.8? I have 13.04 and it have 4.7.3
    So that might be an issue if was not done properly!







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jun 17 '13 at 11:09









    Stefano MtangooStefano Mtangoo

    2,12912136




    2,12912136












    • I did your instruction but the problem did not solve. for installing gcc-4.8 refer to the link : askubuntu.com/questions/271388/…
      – alireza yousefi
      Jun 18 '13 at 7:41












    • Can you upload CmakeList.txt or screenshot of CMake GUI configurations? What happens if you cahnge line from <cmath> to <cmath.h>?
      – Stefano Mtangoo
      Jun 18 '13 at 11:51










    • download the CmakeList.txt , and when I replace the <cmath> with <cmath.h> the error remain the same.
      – alireza yousefi
      Jun 19 '13 at 10:40












    • To convert C++ sources to C (or ancient C++), <cmath> should be replaced with <math.h> (no c which denotes C standard libraries used in C++).
      – Melebius
      Dec 6 '18 at 7:22




















    • I did your instruction but the problem did not solve. for installing gcc-4.8 refer to the link : askubuntu.com/questions/271388/…
      – alireza yousefi
      Jun 18 '13 at 7:41












    • Can you upload CmakeList.txt or screenshot of CMake GUI configurations? What happens if you cahnge line from <cmath> to <cmath.h>?
      – Stefano Mtangoo
      Jun 18 '13 at 11:51










    • download the CmakeList.txt , and when I replace the <cmath> with <cmath.h> the error remain the same.
      – alireza yousefi
      Jun 19 '13 at 10:40












    • To convert C++ sources to C (or ancient C++), <cmath> should be replaced with <math.h> (no c which denotes C standard libraries used in C++).
      – Melebius
      Dec 6 '18 at 7:22


















    I did your instruction but the problem did not solve. for installing gcc-4.8 refer to the link : askubuntu.com/questions/271388/…
    – alireza yousefi
    Jun 18 '13 at 7:41






    I did your instruction but the problem did not solve. for installing gcc-4.8 refer to the link : askubuntu.com/questions/271388/…
    – alireza yousefi
    Jun 18 '13 at 7:41














    Can you upload CmakeList.txt or screenshot of CMake GUI configurations? What happens if you cahnge line from <cmath> to <cmath.h>?
    – Stefano Mtangoo
    Jun 18 '13 at 11:51




    Can you upload CmakeList.txt or screenshot of CMake GUI configurations? What happens if you cahnge line from <cmath> to <cmath.h>?
    – Stefano Mtangoo
    Jun 18 '13 at 11:51












    download the CmakeList.txt , and when I replace the <cmath> with <cmath.h> the error remain the same.
    – alireza yousefi
    Jun 19 '13 at 10:40






    download the CmakeList.txt , and when I replace the <cmath> with <cmath.h> the error remain the same.
    – alireza yousefi
    Jun 19 '13 at 10:40














    To convert C++ sources to C (or ancient C++), <cmath> should be replaced with <math.h> (no c which denotes C standard libraries used in C++).
    – Melebius
    Dec 6 '18 at 7:22






    To convert C++ sources to C (or ancient C++), <cmath> should be replaced with <math.h> (no c which denotes C standard libraries used in C++).
    – Melebius
    Dec 6 '18 at 7:22















    0














    Is libm automatically linked too, while compiling ?



    libm is for compiler g++ and is automatically linked. If you use gcc as compiler you need to link manually with math.h



    I found this link here about different compilers generally :



    https://stackoverflow.com/questions/1033898/why-do-you-have-to-link-the-math-library-in-c



    By the way - there is http://boost.org



    You could compile and include with boost-libraries too.






    share|improve this answer























    • how can I linked manually to math.h
      – alireza yousefi
      Jun 18 '13 at 7:58










    • with gcc it looks this: gcc example.c -o example -lm for more precise compiling you do this: gcc -ggdb -Wall example.c -o example -lm
      – dschinn1001
      Jun 18 '13 at 17:19










    • with gcc it looks this: gcc example.c -o example -lm for more precise compiling you do this: gcc -ggdb -Wall example.c -o example -lm (provided - there is: #include <math.h> at the beginning of example.c)
      – dschinn1001
      Jun 18 '13 at 17:32
















    0














    Is libm automatically linked too, while compiling ?



    libm is for compiler g++ and is automatically linked. If you use gcc as compiler you need to link manually with math.h



    I found this link here about different compilers generally :



    https://stackoverflow.com/questions/1033898/why-do-you-have-to-link-the-math-library-in-c



    By the way - there is http://boost.org



    You could compile and include with boost-libraries too.






    share|improve this answer























    • how can I linked manually to math.h
      – alireza yousefi
      Jun 18 '13 at 7:58










    • with gcc it looks this: gcc example.c -o example -lm for more precise compiling you do this: gcc -ggdb -Wall example.c -o example -lm
      – dschinn1001
      Jun 18 '13 at 17:19










    • with gcc it looks this: gcc example.c -o example -lm for more precise compiling you do this: gcc -ggdb -Wall example.c -o example -lm (provided - there is: #include <math.h> at the beginning of example.c)
      – dschinn1001
      Jun 18 '13 at 17:32














    0












    0








    0






    Is libm automatically linked too, while compiling ?



    libm is for compiler g++ and is automatically linked. If you use gcc as compiler you need to link manually with math.h



    I found this link here about different compilers generally :



    https://stackoverflow.com/questions/1033898/why-do-you-have-to-link-the-math-library-in-c



    By the way - there is http://boost.org



    You could compile and include with boost-libraries too.






    share|improve this answer














    Is libm automatically linked too, while compiling ?



    libm is for compiler g++ and is automatically linked. If you use gcc as compiler you need to link manually with math.h



    I found this link here about different compilers generally :



    https://stackoverflow.com/questions/1033898/why-do-you-have-to-link-the-math-library-in-c



    By the way - there is http://boost.org



    You could compile and include with boost-libraries too.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited May 23 '17 at 12:39









    Community

    1




    1










    answered Jun 17 '13 at 12:15









    dschinn1001dschinn1001

    2,24431734




    2,24431734












    • how can I linked manually to math.h
      – alireza yousefi
      Jun 18 '13 at 7:58










    • with gcc it looks this: gcc example.c -o example -lm for more precise compiling you do this: gcc -ggdb -Wall example.c -o example -lm
      – dschinn1001
      Jun 18 '13 at 17:19










    • with gcc it looks this: gcc example.c -o example -lm for more precise compiling you do this: gcc -ggdb -Wall example.c -o example -lm (provided - there is: #include <math.h> at the beginning of example.c)
      – dschinn1001
      Jun 18 '13 at 17:32


















    • how can I linked manually to math.h
      – alireza yousefi
      Jun 18 '13 at 7:58










    • with gcc it looks this: gcc example.c -o example -lm for more precise compiling you do this: gcc -ggdb -Wall example.c -o example -lm
      – dschinn1001
      Jun 18 '13 at 17:19










    • with gcc it looks this: gcc example.c -o example -lm for more precise compiling you do this: gcc -ggdb -Wall example.c -o example -lm (provided - there is: #include <math.h> at the beginning of example.c)
      – dschinn1001
      Jun 18 '13 at 17:32
















    how can I linked manually to math.h
    – alireza yousefi
    Jun 18 '13 at 7:58




    how can I linked manually to math.h
    – alireza yousefi
    Jun 18 '13 at 7:58












    with gcc it looks this: gcc example.c -o example -lm for more precise compiling you do this: gcc -ggdb -Wall example.c -o example -lm
    – dschinn1001
    Jun 18 '13 at 17:19




    with gcc it looks this: gcc example.c -o example -lm for more precise compiling you do this: gcc -ggdb -Wall example.c -o example -lm
    – dschinn1001
    Jun 18 '13 at 17:19












    with gcc it looks this: gcc example.c -o example -lm for more precise compiling you do this: gcc -ggdb -Wall example.c -o example -lm (provided - there is: #include <math.h> at the beginning of example.c)
    – dschinn1001
    Jun 18 '13 at 17:32




    with gcc it looks this: gcc example.c -o example -lm for more precise compiling you do this: gcc -ggdb -Wall example.c -o example -lm (provided - there is: #include <math.h> at the beginning of example.c)
    – dschinn1001
    Jun 18 '13 at 17:32











    0














    With gcc it looks this:



    gcc example.c -o example -lm   


    for more precise compiling (with debugging output in case of failures) you do this:



    gcc -ggdb -Wall example.c -o example -lm


    lm is here the linking with the math-library of gcc (there is #include math.h at the beginning of example.c).






    share|improve this answer




























      0














      With gcc it looks this:



      gcc example.c -o example -lm   


      for more precise compiling (with debugging output in case of failures) you do this:



      gcc -ggdb -Wall example.c -o example -lm


      lm is here the linking with the math-library of gcc (there is #include math.h at the beginning of example.c).






      share|improve this answer


























        0












        0








        0






        With gcc it looks this:



        gcc example.c -o example -lm   


        for more precise compiling (with debugging output in case of failures) you do this:



        gcc -ggdb -Wall example.c -o example -lm


        lm is here the linking with the math-library of gcc (there is #include math.h at the beginning of example.c).






        share|improve this answer














        With gcc it looks this:



        gcc example.c -o example -lm   


        for more precise compiling (with debugging output in case of failures) you do this:



        gcc -ggdb -Wall example.c -o example -lm


        lm is here the linking with the math-library of gcc (there is #include math.h at the beginning of example.c).







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jun 17 '17 at 17:09









        Ravexina

        31.6k1482111




        31.6k1482111










        answered Jun 18 '13 at 17:21









        dschinn1001dschinn1001

        2,24431734




        2,24431734






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f309195%2fcmath-no-such-file-or-directory-include-cmath%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to change which sound is reproduced for terminal bell?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

            Can I use Tabulator js library in my java Spring + Thymeleaf project?