community: Boost.Test 1.65.1, 1.66.0 link problem (Windows)

Consider the following test example: conanfile.txt

[requires]
Boost.Test/1.65.1@bincrafters/stable

[generators]
cmake

CMakeLists.txt

project(test CXX)
cmake_minimum_required(VERSION 3.10)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

add_executable(main main.cpp)
target_link_libraries(main CONAN_PKG::Boost.Test)

main.cpp

#define BOOST_TEST_MODULE Test
#include <boost/test/unit_test.hpp>

Trying to build it:

mkdir build
cd build
conan install ..
cmake .. -G "Visual Studio 15 Win64"
cmake --build . --config Release

The last command fails with:

Link:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\bin\HostX86\x64\link.exe /ERRORREPORT:QUEUE /O
  UT:"C:\Users\dbely\conan\test-boost\build\bin\main.exe" /INCREMENTAL:NO /NOLOGO C:\.conan\lrp4h4by\1\lib\libboost_prg_exec_monitor.lib C:
  \.conan\lrp4h4by\1\lib\libboost_test_exec_monitor.lib C:\.conan\lrp4h4by\1\lib\libboost_unit_test_framework.lib C:\.conan\678o_6yu\1\lib\
  libboost_container.lib C:\.conan\vlo9eck0\1\lib\libboost_exception.lib C:\.conan\kwmtgrd6\1\lib\libboost_regex.lib C:\.conan\xhm4dv19\1\l
  ib\libboost_timer.lib C:\.conan\9u6x411z\1\lib\libboost_chrono.lib C:\.conan\h46afy7v\1\lib\libboost_system.lib kernel32.lib user32.lib g
  di32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiA
  ccess='false'" /manifest:embed /PDB:"C:/Users/dbely/conan/test-boost/build/bin/main.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMP
  AT /IMPLIB:"C:/Users/dbely/conan/test-boost/build/lib/main.lib" /MACHINE:X64  /machine:x64 main.dir\Release\main.obj
libboost_prg_exec_monitor.lib(cpp_main.obj) : error LNK2019: unresolved external symbol "int __cdecl cpp_main(int,char * * const)" (?cpp_ma in@@YAHHQEAPEAD@Z) referenced in function main [C:\Users\dbely\conan\test-boost\build\main.vcxproj]
C:\Users\dbely\conan\test-boost\build\bin\main.exe : fatal error LNK1120: 1 unresolved externals [C:\Users\dbely\conan\test-boost\build\mai n.vcxproj]

If I edit .vcxproj file to remove libboost_prg_exec_monitor.lib from link libraries, or reorder them to make libboost_test_exec_monitor.lib coming first, it links OK.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 23 (10 by maintainers)

Commits related to this issue

Most upvoted comments

I’m with @SSE4 … We just need to remove it and just document that it’s there if someone really has a need for it.

Very interesting… great find! Although… seems pretty annoying from user perspective. So is this a workaround, or just a nuance in the usage of the library that the user needs to be aware of? Trying to figure out if we should change our package or not.