Boost logo

Boost Users :

Subject: [Boost-users] [coroutines2] Building coroutines2 examples
From: Adi Shavit (adishavit_at_[hidden])
Date: 2015-11-10 02:38:57


Hi,

  I'm trying to build the Boost 1.59 coroutine and coroutine2 examples.
I built boost with b2 (complete build) and am using CMake to generate a
VC2015 project to build the samples.

All the coroutine samples build and run just fine, but I get *linking*
errors with the coroutine2 samples.

My CMakeLists.txt file is straightforward, just find boost, include the
headers and link to the boost libs:

project (coroutines-samples)
cmake_minimum_required(VERSION 2.8)

find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIRS})

add_executable(chaining.cpp
/some/path/boost_1_59_0/libs/coroutine/example/cpp03/asymmetric/chaining.cpp)
add_executable(echo.cpp
/some/path/boost_1_59_0/libs/coroutine/example/cpp03/asymmetric/echo.cpp)
add_executable(exception.cpp
 /some/path/boost_1_59_0/libs/coroutine/example/cpp03/asymmetric/exception.cpp)
add_executable(fibonacci.cpp
 /some/path/boost_1_59_0/libs/coroutine/example/cpp03/asymmetric/fibonacci.cpp)
add_executable(layout.cpp
/some/path/boost_1_59_0/libs/coroutine/example/cpp03/asymmetric/layout.cpp)
add_executable(parallel.cpp
/some/path/boost_1_59_0/libs/coroutine/example/cpp03/asymmetric/parallel.cpp)
add_executable(power.cpp
 /some/path/boost_1_59_0/libs/coroutine/example/cpp03/asymmetric/power.cpp)
add_executable(same_fringe.cpp
 /some/path/boost_1_59_0/libs/coroutine/example/cpp03/asymmetric/same_fringe.cpp)
add_executable(segmented_stack.cpp
 /some/path/boost_1_59_0/libs/coroutine/example/cpp03/asymmetric/segmented_stack.cpp)
add_executable(simple.cpp
/some/path/boost_1_59_0/libs/coroutine/example/cpp03/asymmetric/simple.cpp)
add_executable(unwind.cpp
/some/path/boost_1_59_0/libs/coroutine/example/cpp03/asymmetric/unwind.cpp)
add_executable(dice_game.cpp
 /some/path/boost_1_59_0/libs/coroutine/example/cpp03/symmetric/dice_game.cpp)
add_executable(merge_arrays.cpp
/some/path/boost_1_59_0/libs/coroutine/example/cpp03/symmetric/merge_arrays.cpp)
add_executable(segmented_stack1.cpp
/some/path/boost_1_59_0/libs/coroutine/example/cpp03/symmetric/segmented_stack.cpp)
add_executable(simple1.cpp
 /some/path/boost_1_59_0/libs/coroutine/example/cpp03/symmetric/simple.cpp)
add_executable(unwind1.cpp
 /some/path/boost_1_59_0/libs/coroutine/example/cpp03/symmetric/unwind.cpp)
add_executable(await_emu.cpp
 /some/path/boost_1_59_0/libs/coroutine/example/cpp11/asymmetric/await_emu.cpp)
add_executable(fibonacci11.cpp
 /some/path/boost_1_59_0/libs/coroutine/example/cpp11/asymmetric/fibonacci.cpp)
add_executable(iterator_range.cpp
/some/path/boost_1_59_0/libs/coroutine/example/cpp11/asymmetric/iterator_range.cpp)
add_executable(layout11.cpp
/some/path/boost_1_59_0/libs/coroutine/example/cpp11/asymmetric/layout.cpp)
add_executable(same_fringe11.cpp
 /some/path/boost_1_59_0/libs/coroutine/example/cpp11/asymmetric/same_fringe.cpp)
add_executable(merge_arrays1.cpp
 /some/path/boost_1_59_0/libs/coroutine/example/cpp11/symmetric/merge_arrays.cpp)
add_executable(simple2.cpp
 /some/path/boost_1_59_0/libs/coroutine/example/cpp11/symmetric/simple.cpp)

# coroutines2
add_executable(coro2_fibonacci
/some/path/boost_1_59_0/libs/coroutine2/example/fibonacci.cpp)
add_executable(coro2_layout
 /some/path/boost_1_59_0/libs/coroutine2/example/layout.cpp)
add_executable(coro2_parser
 /some/path/boost_1_59_0/libs/coroutine2/example/parser.cpp)
add_executable(coro2_same_fringe
/some/path/boost_1_59_0/libs/coroutine2/example/same_fringe.cpp)
add_executable(coro2_segmented
/some/path/boost_1_59_0/libs/coroutine2/example/segmented.cpp)
add_executable(coro2_simple
 /some/path/boost_1_59_0/libs/coroutine2/example/simple.cpp)

target_link_libraries(chaining.cpp ${Boost_LIBRARIES})
target_link_libraries(echo.cpp ${Boost_LIBRARIES})
target_link_libraries(exception.cpp ${Boost_LIBRARIES})
target_link_libraries(fibonacci.cpp ${Boost_LIBRARIES})
target_link_libraries(layout.cpp ${Boost_LIBRARIES})
target_link_libraries(parallel.cpp ${Boost_LIBRARIES})
target_link_libraries(power.cpp ${Boost_LIBRARIES})
target_link_libraries(same_fringe.cpp ${Boost_LIBRARIES})
target_link_libraries(segmented_stack.cpp ${Boost_LIBRARIES})
target_link_libraries(simple.cpp ${Boost_LIBRARIES})
target_link_libraries(unwind.cpp ${Boost_LIBRARIES})
target_link_libraries(dice_game.cpp ${Boost_LIBRARIES})
target_link_libraries(merge_arrays.cpp ${Boost_LIBRARIES})
target_link_libraries(segmented_stack1.cpp ${Boost_LIBRARIES})
target_link_libraries(simple1.cpp ${Boost_LIBRARIES})
target_link_libraries(unwind1.cpp ${Boost_LIBRARIES})
target_link_libraries(await_emu.cpp ${Boost_LIBRARIES})
target_link_libraries(fibonacci11.cpp ${Boost_LIBRARIES})
target_link_libraries(iterator_range.cpp ${Boost_LIBRARIES})
target_link_libraries(layout11.cpp ${Boost_LIBRARIES})
target_link_libraries(same_fringe11.cpp ${Boost_LIBRARIES})
target_link_libraries(merge_arrays1.cpp ${Boost_LIBRARIES})
target_link_libraries(simple2.cpp ${Boost_LIBRARIES})

target_link_libraries(coro2_fibonacci ${Boost_LIBRARIES})
target_link_libraries(coro2_layout ${Boost_LIBRARIES})
target_link_libraries(coro2_parser ${Boost_LIBRARIES})
target_link_libraries(coro2_same_fringe ${Boost_LIBRARIES})
target_link_libraries(coro2_segmented ${Boost_LIBRARIES})
target_link_libraries(coro2_simple ${Boost_LIBRARIES})

The linked does not seem to be able to find boost::system::system_category.
This is my error log:

11>------ Build started: Project: coro2_fibonacci, Configuration: Debug x64
------

2>------ Build started: Project: coro2_layout, Configuration: Debug x64
------

3>------ Build started: Project: coro2_parser, Configuration: Debug x64
------

4>------ Build started: Project: coro2_same_fringe, Configuration: Debug
x64 ------

5>------ Build started: Project: coro2_segmented, Configuration: Debug x64
------

6>------ Build started: Project: coro2_simple, Configuration: Debug x64
------

1>libboost_context-vc140-mt-gd-1_59.lib(stack_traits.obj) : error LNK2019:
unresolved external symbol "class boost::system::error_category const &
__cdecl boost::system::system_category(void)" (?system_category_at_system
@boost@@YAAEBVerror_category_at_12@XZ) referenced in function "public: __cdecl
boost::thread_exception::thread_exception(int,char const *)"
(??0thread_exception_at_boost@@QEAA_at_HPEBD@Z)

1>\some\path\Coroutines\build\vs2015.x64\Debug\coro2_fibonacci.exe : fatal
error LNK1120: 1 unresolved externals

4>libboost_context-vc140-mt-gd-1_59.lib(stack_traits.obj) : error LNK2019:
unresolved external symbol "class boost::system::error_category const &
__cdecl boost::system::system_category(void)" (?system_category_at_system
@boost@@YAAEBVerror_category_at_12@XZ) referenced in function "public: __cdecl
boost::thread_exception::thread_exception(int,char const *)"
(??0thread_exception_at_boost@@QEAA_at_HPEBD@Z)

4>\some\path\Coroutines\build\vs2015.x64\Debug\coro2_same_fringe.exe :
fatal error LNK1120: 1 unresolved externals

6>libboost_context-vc140-mt-gd-1_59.lib(stack_traits.obj) : error LNK2019:
unresolved external symbol "class boost::system::error_category const &
__cdecl boost::system::system_category(void)" (?system_category_at_system
@boost@@YAAEBVerror_category_at_12@XZ) referenced in function "public: __cdecl
boost::thread_exception::thread_exception(int,char const *)"
(??0thread_exception_at_boost@@QEAA_at_HPEBD@Z)

2>libboost_context-vc140-mt-gd-1_59.lib(stack_traits.obj) : error LNK2019:
unresolved external symbol "class boost::system::error_category const &
__cdecl boost::system::system_category(void)" (?system_category_at_system
@boost@@YAAEBVerror_category_at_12@XZ) referenced in function "public: __cdecl
boost::thread_exception::thread_exception(int,char const *)"
(??0thread_exception_at_boost@@QEAA_at_HPEBD@Z)

3>libboost_context-vc140-mt-gd-1_59.lib(stack_traits.obj) : error LNK2019:
unresolved external symbol "class boost::system::error_category const &
__cdecl boost::system::system_category(void)" (?system_category_at_system
@boost@@YAAEBVerror_category_at_12@XZ) referenced in function "public: __cdecl
boost::thread_exception::thread_exception(int,char const *)"
(??0thread_exception_at_boost@@QEAA_at_HPEBD@Z)

5>libboost_context-vc140-mt-gd-1_59.lib(stack_traits.obj) : error LNK2019:
unresolved external symbol "class boost::system::error_category const &
__cdecl boost::system::system_category(void)" (?system_category_at_system
@boost@@YAAEBVerror_category_at_12@XZ) referenced in function "public: __cdecl
boost::thread_exception::thread_exception(int,char const *)"
(??0thread_exception_at_boost@@QEAA_at_HPEBD@Z)

6>\some\path\Coroutines\build\vs2015.x64\Debug\coro2_simple.exe : fatal
error LNK1120: 1 unresolved externals

2>\some\path\Coroutines\build\vs2015.x64\Debug\coro2_layout.exe : fatal
error LNK1120: 1 unresolved externals

3>\some\path\Coroutines\build\vs2015.x64\Debug\coro2_parser.exe : fatal
error LNK1120: 1 unresolved externals

5>\some\path\Coroutines\build\vs2015.x64\Debug\coro2_segmented.exe : fatal
error LNK1120: 1 unresolved externals

7>------ Skipped Build: Project: ALL_BUILD, Configuration: Debug x64 ------

7>Project not selected to build for this solution configuration

========== Build: 0 succeeded, 6 failed, 25 up-to-date, 1 skipped ==========

What am I doing wrong?
Thanks,
Adi



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net