S
S
Slady2019-06-27 11:20:34
Python
Slady, 2019-06-27 11:20:34

How to connect boost.python without errors?

There is a structure like this :
/boost
/src
_nonsence.cpp
CMakeLists.txt
Content of CMakeLists.txt :
cmake_minimum_required(VERSION 3.10)
project(_PROTOCOL)
#create executable file
add_executable(main src/_nonsence.cpp)
#Boost lib
set(BOOST_ROOT ./boost )
find_package(Boost REQUIRED)
if(Boost_FOUND)
message("BOOST FOUND")
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(main ${Boost_LIBRARIES})
endif()
Content of _nonsence.cpp :
#include
int main()
{
return 0;
}
Error : CMake
5d147bb29d0e5314041964.png
version : 3.14 boost version : 1.70 python version : 3.7.0 I built the boost library using gcc: bootstrap.bat gcc b2 toolset=gcc --prefix=. install gcc version : 6.3.0 Tried to include python header files, pyconfig.h etc: Changed CMakeLists.txt: cmake_minimum_required(VERSION 3.10) project(_PROTOCOL) #create executable file add_executable(main src/_nonsence.cpp) #Boost lib set(BOOST_ROOT ./boost) find_package(Boost REQUIRED) if(Boost_FOUND) message("BOOST FOUND")



include_directories(${Boost_INCLUDE_DIRS})
+ include_directories( /include/py)
target_link_libraries(main ${Boost_LIBRARIES})
endif()
Prints warnings and an error at the end:
5d147bc90c912044959424.png
5d147bce82e03092826187.png
While other boost libraries are linked and work fine.
How to connect boost.python without errors?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Makarov, 2019-06-27
@Nipheris

Since you have a fresh CMake and if I understand your intentions correctly, let's try this option:

cmake_minimum_required(VERSION 3.14)
project(foobaria)

find_package(Python3 REQUIRED COMPONENTS Development)
find_package(Boost REQUIRED COMPONENTS python)

python3_add_library(main MODULE src/_nonsence.cpp)
target_link_libraries(main Boost::python) # тут возможно нужно Boost::python3

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question