我正在閱讀「LLVM核心庫入門」一書,但我無法編譯第3章中的示例。我已按照作者的建議安裝了LLVM 3.4。我正在使用Mint Linux 64位。LLVM核心庫入門書無法編譯代碼
In file included from helloworld.c:1:0:
/home/user/llvm3.4/llvm/include/llvm/Bitcode/ReaderWriter.h:17:18: fatal error: string: No such file or directory
#include <string>
^
compilation terminated.
編輯:從.C重命名文件到.CPP
現在我面臨的另一個問題解決了上述問題。
helloworld.cpp: In function ‘int main(int, char**)’:
helloworld.cpp:16:21: error: aggregate ‘llvm::LLVMContext context’ has incomplete type and cannot be defined
LLVMContext context;
^
helloworld.cpp:22:21: error: ‘cerr’ was not declared in this scope
std:cerr << "Error reading bitcode: " << error << std::end;
^
helloworld.cpp:22:21: note: suggested alternative:
In file included from helloworld.cpp:8:0:
/usr/include/c++/4.8/iostream:62:18: note: ‘std::cerr’
extern ostream cerr; /// Linked to standard error (unbuffered)
^
helloworld.cpp:22:17: warning: label ‘std’ defined but not used [-Wunused-label]
std:cerr << "Error reading bitcode: " << error << std::end;
^
make: *** [helloworld] Error 1
UPDATE:
檢查我的回答下面這有鏈接到一個碼頭工人的工作形象。
它應該是C還是C++?看起來你在C文件中包含一個C++頭文件。 – Biffen 2014-09-06 09:33:36
你應該爲你的新問題提出一個新問題。 – Biffen 2014-09-06 09:34:43
有沒有人有一個碼頭安裝程序的所有示例代碼編譯?我錯誤後出現錯誤:(編輯:示例代碼在這裏http://examples.oreilly.com/9781782166924/ – user361697 2014-09-06 09:43:56