我无法配置 distcc 来编译 C++ 文件。我在 C++ 中做了一个标准的小型“Hello, World”程序,并试图让 distcc 在本地编译它(在我喜欢一个更大的项目之前),但我得到了“未定义的引用”错误。
我的程序,名为“hello.cpp”:
#include <iostream>
int main(){
std::cout << "Hello World in c++" << std::endl;
return 0;
}
我的命令:
$ distcc hello.cpp
终端输出:
/tmp/cc5rZwhV.o: In function `main': <br>
hello.cpp:(.text+0xa): undefined reference to `std::cout' <br>
hello.cpp:(.text+0xf): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)' <br>
hello.cpp:(.text+0x14): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)' <br>
hello.cpp:(.text+0x1c): undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))' <br>
/tmp/cc5rZwhV.o: In function `__static_initialization_and_destruction_0(int, int)': <br>
hello.cpp:(.text+0x4a): undefined reference to `std::ios_base::Init::Init()' <br>
hello.cpp:(.text+0x59): undefined reference to `std::ios_base::Init::~Init()' <br>
collect2: error: ld returned 1 exit status <br>
distcc[21053] ERROR: compile hello.cpp on localhost failed <br>
其他信息:
这个程序用 g++ 和 C++ 编译得很好。一个用 C 编写的类似程序使用printf
distcc。
输出$ distcc --version
:
distcc 3.2rc1 x86_64-unknown-linux-gnu
(protocols 1, 2 and 3) (default port 3632)
built Jul 7 2014 13:18:34
....(copyright stuff)