我正在尝试仅使用一个文件编译一个小型c ++项目。 BoostRegex.cpp的第5行是:
#include <iostream>
#include <string>
#include <regex.hpp>
int main() { ....
我运行以下./configure行(它是交叉编译):
cmake -DCMAKE_TOOLCHAIN_FILE=/home/vitor/bin/raspi/cmaketoolchain/toolchain.cmake ../src/
此行适用于以下输出:
[vitor@archlinux bin]$ cmake -DCMAKE_TOOLCHAIN_FILE=/home/vitor/bin/rasp/cmaketoolchain/toolchain.cmake ../src/
-- The C compiler identification is GNU 4.7.3
-- The CXX compiler identification is GNU 4.7.3
-- Check for working C compiler: /home/vitor/local/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc
-- Check for working C compiler: /home/vitor/local/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /home/vitor/local/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-g++
-- Check for working CXX compiler: /home/vitor/local/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Boost version: 1.49.0
-- Found the following Boost libraries:
-- system
-- regex
-- unit_test_framework
status ** Boost Root: /home/vitor/local/usr/lib **
status ** Boost Include: /home/vitor/local/usr/include **
status ** Boost Libraries Dirs: **
status ** Boost Librraries: /home/vitor/local/usr/lib **
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vitor/tmp/boost-regex/bin
但是当我运行make命令时:
[vitor@archlinux bin]$ make
Scanning dependencies of target BoostRegex
[100%] Building CXX object CMakeFiles/BoostRegex.dir/BoostRegex.cpp.o
In file included from /home/vitor/local/usr/include/features.h:323:0,
from /home/vitor/local/x-tools/arm-unknown-linux-gnueabi/lib/gcc/arm-unknown-linux-gnueabi/4.7.3/../../../../arm-unknown-linux-gnueabi/include/c++/4.7.3/arm-unknown-linux-gnueabi/bits/os_defines.h:40,
from /home/vitor/local/x-tools/arm-unknown-linux-gnueabi/lib/gcc/arm-unknown-linux-gnueabi/4.7.3/../../../../arm-unknown-linux-gnueabi/include/c++/4.7.3/arm-unknown-linux-gnueabi/bits/c++config.h:414,
from /home/vitor/local/x-tools/arm-unknown-linux-gnueabi/lib/gcc/arm-unknown-linux-gnueabi/4.7.3/../../../../arm-unknown-linux-gnueabi/include/c++/4.7.3/iostream:39,
from /home/vitor/tmp/boost-regex/src/BoostRegex.cpp:1:
/home/vitor/local/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sysroot/usr/include/bits/predefs.h:23:3: error: #error "Never use <bits/predefs.h> directly; include <stdc-predef.h> instead."
/home/vitor/tmp/boost-regex/src/BoostRegex.cpp:3:21: fatal error: regex.hpp: No such file or directory
compilation terminated.
make[2]: *** [CMakeFiles/BoostRegex.dir/BoostRegex.cpp.o] Error 1
make[1]: *** [CMakeFiles/BoostRegex.dir/all] Error 2
make: *** [all] Error 2
我必须再次指出boost lib的标题?我该怎么办?
答案 0 :(得分:0)