【发布时间】:2022-08-24 01:17:01
【问题描述】:
我正在尝试使用以下称为 LoopTools 的 C++ 工具:http://www.feynarts.de/looptools/
它基本上给出了一些积分的数值。
manual 说,为了使用它,我必须:
就像在 Fortran 案例中一样,它节省了大量的输入来指定 LoopTools 的位置 一次在环境变量中。例如,在 tcsh 中,使用
setenv LT $HOME/LoopTools/(hosttype)然后使用以下命令编译使用 LoopTools 的程序:$LT/bin/fcc -I$LT/include (source files) -L$LT/lib -looptools我尝试使用他们提供的示例代码来执行此操作:
#include <iostream> #include \"clooptools.h\" int main() { ltini(); cout << B0(1000., 50., 80.) << endl; ltexi(); }我将此代码保存为 \"example.cpp\" 并尝试使用他们所说的进行编译,即:
g++ example.cpp $LT/bin/fcc -I$LT/include -L$LT/lib -looptools但我得到以下
.../LoopTools-2.16/x86_64-Linux/bin/fcc: file not recognized: file format not recognized collect2: error: ld returned 1 exit status我应该怎么办?
-
你应该做的是弄清楚你是否为你的操作系统下载了正确的二进制文件。您是否尝试在 64 位 Linux 发行版上运行它?或许您还应该重新考虑从 Internet 下载随机二进制文件,并首先在您的计算机上运行它们。
-
他们希望您使用
$LT/bin/fcc作为编译器,而不是g++。 -
好的,我发现它实际上应该是
$LT/bin/fcc -I$LT/include -L$LT/lib64 -looptools。 @HolyBlackCat 现在我尝试将其编译为$LT/bin/fcc example.cpp -I$LT/include -L$LT/lib64 -looptools,现在我收到以下错误:/usr/bin/ld: /tmp/ccsFqRan.o: in function _GLOBAL__sub_I_first_try.cpp\': /usr/include/c++/11/iostream:74: undefined reference to std::ios_base::Init::Init()\' /usr/bin/ld: /tmp/ccsFqRan.o: in function __static_initialization_and_destruction_0\': /usr/include/c++/11/iostream:74: undefined reference to std::ios_base::Init::~Init()\' -
@SamVarshavchik 我想我确实下载了正确的,特别是因为只有一个链接可供下载。这个工具也可用于 Mathematica,我用过它没有问题,但我现在正试图在 C++ 上使用它
-
如果
fcc相当于gcc,那么它将尝试像C 程序而不是C++ 程序一样编译它,并且不会链接<iostream>使用的库。
标签: c++