Вопрос

I'm trying to compile a small c++ project with one file only. The 5 first lines of BoostRegex.cpp are:

#include <iostream>
#include <string>
#include <regex.hpp>

int main() { ....

I run the following ./configure line (it's a cross compile):

cmake -DCMAKE_TOOLCHAIN_FILE=/home/vitor/bin/raspi/cmaketoolchain/toolchain.cmake ../src/

This line works with the following output:

[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

But when I run the make command:

[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

I have to indicate once again the headers of boost lib? How can I do it?

Это было полезно?

Решение

This looks like an error in your CMakeLists.txt

Are you including the correct dirs as per the FindBoost module?

include_directories(${Boost_INCLUDE_DIRS})
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top