我下载并尝试安装“wfconvert”包此链接.但我遇到了一些错误。
这是我所做的:
- 复制根目录“/”中的 wfconvert 文件夹
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
make 命令
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
我不知道该怎么办!
这是我的 cmath 文件列表:
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
和
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
请帮我。
答案1
我怀疑是开发工具安装损坏或类似问题。我要做的第一件事是重新安装构建包
sudo apt-get purge build-essential
sudo apt-get install build-essential
如果问题仍然存在,请回复
只是好奇:你是如何安装 GCC 4.8 的?我有 13.04,它有 4.7.3,所以如果操作不正确,这可能是一个问题!
答案2
编译时 libm 是否也会自动链接?
libm 用于编译器 g++,并自动链接。如果您使用 gcc 作为编译器,则需要手动链接 math.h
我在这里找到了有关不同编译器的链接:
https://stackoverflow.com/questions/1033898/why-do-you-have-to-link-the-math-library-in-c
顺便说一下 -http://boost.org
您也可以编译并包含 boost-libraries。
答案3
使用 gcc 它看起来像这样:
gcc example.c -o example -lm
为了更精确地进行编译(在发生故障时进行调试输出),您可以执行以下操作:
gcc -ggdb -Wall example.c -o example -lm
这里 lm 是与 gcc 的数学库的链接(在 example.c 的开头有 #include math.h)。