我试图开始premake但我无法让我的测试项目与它正确链接。如果我把它链接起来手动它虽然工作正常。无法链接我的解决方案中的其他项目与预制
我在OS X 10.9上使用premake 4.3(也用premake 4.4测试过),并且使用了clang 3.4。
我通过创建 “premake4 gmake命令” 生成文件,并尝试编译后,我得到一个错误这样的:
Linking subproject
ld: internal error: atom not found in symbolIndex(__ZNSt3__1lsINS_11char_traitsIcEEEERNS_13basic_ostreamIcT_EES6_PKc) for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [libsubproject.dylib] Error 1
make: *** [subproject] Error 2
我很简单的项目设置:
project/
src/
test.cpp
subproject/
include/
Library.hpp
source/
Library.cpp
premake4.lua
premake4.lua
solution "testa"
configurations {"debug"}
language "C++"
includedirs {"subproject/include"}
project "subproject"
kind "SharedLib"
files {"subproject/source/*.cpp"}
project "main"
kind "ConsoleApp"
files {"src/*.cpp"}
links {"subproject"}
src/test.cpp
#include <iostream>
#include <Library.hpp>
using namespace std;
int main() {
cout << "Hello, World!" << endl;
Library lib(13, 3);
lib.do_stuff(7);
return 0;
}
子项目/包括/ Library.hpp
#ifndef __LIBRARY_HPP__
#define __LIBRARY_HPP__
#include <iostream>
using namespace std;
class Library {
public:
Library(int, int);
void do_stuff(int) const;
private:
int x;
int y;
};
#endif
子项目/源/ Library.cpp
#include <Library.hpp>
Library::Library(int x, int y) {
this->x = x;
this->y = y;
}
void Library::do_stuff(int z) const {
cout << "X: " << x << "Y: " << y << "Z: " << z << endl;
}
谢谢您的时间。
[此Google搜索](https://www.google.com/#q=internal+error%3A+atom+not+found+in+symbolIndex)似乎指向Clang中与死代码相关的错误剥离。虽然我还没有能够找出让它工作所需的魔法构建标志。 – starkos