I'm trying to create example boost.python module, but i have only link errors
The boost was built with command
b2 --with-python address-model=64 toolset=msvc --build-dir=build link=shared install stage
the cmake file is this
cmake_minimum_required(VERSION 3.12)
project(my_project)
find_package(Python REQUIRED COMPONENTS Development)
message("found python, version = ${Python_VERSION}")
message("found python, version_major = ${Python_VERSION_MAJOR}")
message("found python, version_minor = ${Python_VERSION_MINOR}")
find_package(Boost COMPONENTS python)
message("Boost Dir: ${Boost_DIR}")
message("Boost Found: ${Boost_FOUND}")
message("Boost Found: ${Boost_INCLUDE_DIR}")
add_library(my_module MODULE my_module.cpp wrap.cpp)
message("trying to link with ${Boost_LIBRARIES}")
target_include_directories(my_module PRIVATE ${Python_INCLUDE_DIRS})
target_link_libraries(my_module PRIVATE ${Python_LIBRARIES})
target_link_libraries(my_module PRIVATE Boost::python)
the output: wrap.obj : error LNK2019: reference to deprecated extern symbol "__declspec(dllimport) void __cdecl boost::python::thr ow_error_already_set(void)" (_imp?throw_error_already_set@python@boost@@YAXXZ) в функции "struct _object * __cdecl bo ost::python::expect_non_null(struct _object *)" (??$expect_non_null@U_object@@@python@boost@@YAPEAU_obj ect@@PEAU2@@Z). [...\build\my_module.vcxproj] ans so on ...
wrap.cpp:
#include <iostream>
#include <boost/python.hpp>
#include "my_module.h"
using namespace boost::python;
BOOST_PYTHON_MODULE( example )
{
class_<Some>( "Some" )
.def( init<int,string>( args( "some_id", "name" ) ) )
.def( "ID", &Some::ID )
.def( "Name", &Some::Name, return_value_policy<copy_const_reference>() )
.def( "ResetID", static_cast< void (Some::*)() >( &Some::ResetID ) )
.def( "ResetID", static_cast< void (Some::*)(int) >( &Some::ResetID ), args( "some_id" ) )
.def( "ChangeName", &Some::ChangeName, args( "name" ) )
.def( "SomeChanges", &Some::SomeChanges, args( "some_id", "name" ) );
}