Ben linux ubuntu basit bir program yazdım ama gcc kullandığınızda şu hatayı görüyorum:"cmath: Böyle bir dosya ya da dizin" Ben gr hiçbir hata yoktur ++ kullandığınızda GCC
test.c:1:17: fatal error: cmath: No such file or directory #include <cmath>
Not: "Aslında bu hatayı paketin derlenmesinde görüyorum, linux ortamına ayarlanmamış gcc kütüphanesiyle ilgili olabileceğini düşündüm, bu yüzden hatayı açıkça belirlemek için basit bir program yazdım ve bağımlılık bağımlılığı! " böylece program gcc ile derlemeliyim, böylece ana problemin üstesinden gelebilirim. Ben cmath yerine math.h kullanabileceğimi, ama packege cmath kullandığını biliyorum!
/*test.c*/
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int main(){
double sinx = sin(3.14/3);
cout<< "sinx= " << sinx;
return 0;
}
burada
olduğunu cmath Pathes: bu basit bir programdır
[email protected]:/# 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
ve yükledikten sonra gcc-4.8 Bu talimat yaptı:
[email protected]:~/Desktop# update-alternatives --install /usr/bin/gcc gcc /app/gcc/4.8.0/bin/gcc 40 --slave /usr/bin/g++ g++ /app/gcc/4.8.0/bin/g++
[email protected]:~/Desktop#update-alternatives --install /usr/bin/gcc gcc /app/gcc/4.8.0/bin/gcc 60 --slave /usr/bin/g++ g++ /app/gcc/4.8.0/bin/g++
[email protected]:~/Desktop# update-alternatives --config gcc
gcc-4.8 yapmak benim varsayılan gcc. Nitekim şimdi
[email protected]:~/Desktop# gcc --version
gcc (GCC) 4.8.0
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
beni
Ne yapacağımı bilmiyorum lütfen yardım https://askubuntu.com/questions/309195/cmath-no-such-file-or-directory-include-cmath
ana sorunu yazdım. g ++, değil gcc ile
teşekkür
1. – Abhineet
cmath C++ için, C ile math.h, eğer dosya .c ile biterse, fakat açıkça ve C++ dosyasıysa, sonu değiştirin. – stdcall