#Downloading Boost ASIO issue

33 messages · Page 1 of 1 (latest)

grizzled marsh
#

I have been trying to download boost asio, but I cannot install b2. When I try to run ./b2 install --prefix=PREFIX, I got the following error.

error: Name clash for '<pC:\Boost\boost_1_82_0\stage\lib>libboost_filesystem-vc143-mt-gd-1_82.lib'
error:
error: Tried to build the target twice, with property sets having
error: these incompatible properties:
error:
error:     -  <address-model>32
error:     -  <address-model>64
error:
error: Please make sure to have consistent requirements for these
error: properties everywhere in your project, especially for install
error: targets.

I also tried to run b2 with following solution https://stackoverflow.com/questions/74901242/installing-boost-1-81-0-failing , but it didn't solve the issue neither.

soft furnaceBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

ember smelt
#

asio is header only, you shouldn’t need to build anything

grizzled marsh
#

so how can I add that to my project? I am using Cmakelist.txt to build

#

I tried the following

cmake_minimum_required (VERSION 3.8)
cmake_policy(SET CMP0079 NEW)

# Enable Hot Reload for MSVC compilers if supported.
if (POLICY CMP0141)
  cmake_policy(SET CMP0141 NEW)
  set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
endif()

project ("HTTPProject")

# Include sub-projects.
add_subdirectory ("HTTPProject")

set(ASIO_VERSION 1.80.0)


add_library(
    Boost_lib
    SHARED
    IMPORTED
    "C:/Program Files/boost/boost_asio_1_30_2/boost/asio.hpp"
)

target_link_libraries(
    HTTPProject PRIVATE Boost_lib
)

ember smelt
#

simply download boost and set BOOST_ROOT to your path where you downloaded boost

grizzled marsh
#

😄

ember smelt
#

find_package is a thing

grizzled marsh
#

so okay i will check BOOST_ROOT and do find_package let me try

ember smelt
#
set(BOOST_ROOT …)
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})```
soft furnaceBOT
#

@ember smelt

It looks like you may have code formatting errors in your message

Note: Make sure to use back-ticks (`) and not quotes (')
Note: Make sure to specify a highlighting language, e.g. `cpp`, after the back-ticks

Markup

```cpp
int main() {}
```

Result
int main() {}
ember smelt
#

smth like that, I am writing from memory

grizzled marsh
#

should I just add the folder path of boost to environment variables?

ember smelt
#

it’s a cmake variable

#

find_package(Boost) calls FindBoost.cmake

#

BOOST_ROOT is a variable you can set if FindBoost can’t find it automatically

grizzled marsh
#

okay I tried BOOST_ROOT but it seems like i am not able to find it. CMake compiles, but still #include <asio.hpp> not found

ember smelt
#

yes

#

<boost/asio.hpp>

grizzled marsh
#

also i have two cmakelist files

why is that exactly?

#

did i make something wrong or is it normal?

ember smelt
#

you do have set HTTPProject as a subproject directory

grizzled marsh
ember smelt
#

reset cache and reload project

#

and see cmake messages to see that boost has indeed been found

grizzled marsh
#

i think it finds boost in the wrong folder

because i downloaded boost in to the following folder "C:\Boost\boost_1_82_0"

ember smelt
#

well if you set boost root to the download path it should work

grizzled marsh
#

I tried that with SET(BOOT_ROOT C:\Boost\boost_1_82_0 , but for some reason when I tried to call find_package it kept finding the one in the anaconda. I decided to change to visual studio environment for now. Thank you for helping

#

!solved