Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 98994

VisualStudio CMake project error : boost/version.hpp" cannot be read

$
0
0

I am developing C++ code using VisualStudio 2019.

I am using CMake to configure the project.

I am using an external SDK toolchain path in order to compile and build my program.

I need to use boost library which is compiled on my remote machine.

My boost include directory is under :

/home/ubuntu/linux4sam/poky/build-microchip/tmp/sysroots-components/cortexa5hf-neon/boost/usr/include/boost

My boost libraries directory is under :

/home/ubuntu/linux4sam/poky/build-microchip/tmp/sysroots-components/cortexa5hf-neon/boost/usr/lib

The boost version I am using is Boost 1.66.0 , I notice that the version is not set in the name of the boost directorie and I don't know if that will impact a problem in finding the package or not.

This is my CMakelists.txt file:

# Add source to this project's executable.
add_executable (CMakeProject4 "CMakeProject4.cpp""CMakeProject4.h")

# TODO: Add tests and install targets if needed.

set(Boost_USE_STATIC_LIBS ON) 
set(Boost_USE_MULTITHREADED OFF)  
set(Boost_USE_STATIC_RUNTIME OFF)
list(APPEND CMAKE_PREFIX_PATH /home/ubuntu/linux4sam/poky/build-microchip/tmp/sysroots-components/cortexa5hf-neon/boost/usr/include/boost)
Set(Boost_NO_BOOST_CMAKE ON)
#set(BOOST_ROOT "/home/ubuntu/linux4sam/poky/build-microchip/tmp/sysroots-components/cortexa5hf-neon/boost")
find_package(Boost 1.66.0) 

if(Boost_FOUND)

    message (STATUS "success!")
    add_executable (CMakeProject4 "CMakeProject4.cpp""CMakeProject4.h") 
    include_directories(${Boost_INCLUDE_DIRS})  
    target_link_libraries(CMakeProject4 ${Boost_LIBRARIES})

endif()

And this is my .cpp file:

#include "CMakeProject4.h"
#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

int main()
{
    typedef std::istream_iterator<int> in;

    std::cout << "Type in any number: ";

    std::for_each(
        in(std::cin), in(), std::cout
        << (boost::lambda::_1 * 10)
        << "\nType in another number: ");
}

And this is CMakeSettings.json file :

{
  "configurations": [
    {
      "addressSanitizerRuntimeFlags": "detect_leaks=0",
      "buildCommandArgs": "",
      "cmakeCommandArgs": "-DBoost_DEBUG=TRUE",
      "cmakeExecutable": "/home/ubuntu/CMake/Executable",
      "cmakeToolchain": "/opt/poky-atmel/2.5.3/sysroots/x86_64-pokysdk-linux/usr/share/cmake/OEToolchainConfig.cmake",
      "configurationType": "RelWithDebInfo",
      "ctestCommandArgs": "",
      "generator": "Unix Makefiles",
      "inheritEnvironments": [ "linux_arm" ],
      "name": "Linux-Release",
      "remoteBuildRoot": "/home/ubuntu/CMake/RemoteBR",
      "remoteCMakeListsRoot": "/home/ubuntu/CMake/RemoteCML",
      "remoteCopyBuildOutput": false,
      "remoteCopySources": true,
      "remoteCopySourcesExclusionList": [ ".vs", ".git", "out" ],
      "remoteCopySourcesMethod": "rsync",
      "remoteInstallRoot": "/home/ubuntu/CMake/RemoteIL",
      "remoteMachineName": "1712046838;192.168.1.11 (username=ubuntu, port=22, authentication=PrivateKey)",
      "rsyncCommandArgs": "-t --delete --delete-excluded",
      "variables": [
        {
          "name": "Boost_INCLUDE_DIRS",
          "value": "/home/ubuntu/linux4sam/poky/build-microchip/tmp/sysroots-components/cortexa5hf-neon/boost/usr/include/boost",
          "type": "PATH"
        },
        {
          "name": "Boost_LIBRARIES",
          "value": "/home/ubuntu/linux4sam/poky/build-microchip/tmp/sysroots-components/cortexa5hf-neon/boost/usr/lib",
          "type": "PATH"
        },
        {
          "name": "Boost_INCLUDE_DIR",
          "value": "/home/ubuntu/linux4sam/poky/build-microchip/tmp/sysroots-components/cortexa5hf-neon/boost/usr/include/boost",
          "type": "PATH"
        }
      ]
    }
  ]
}

When I run my code, an error occurs saying that he can not read version.hpp file. i Thought that this file is missing in the described path but I can find it ! When I open it I can see that's the file for BOOST_LIB_VERSION 1_66 .

This is the error :

Error CMake Error at /home/ubuntu/.vs/cmake/share/cmake-3.15/Modules/FindBoost.cmake:1600 (file): file STRINGS file
"/home/ubuntu/linux4sam/poky/build-microchip/tmp/sysroots-components/cortexa5hf-neon/boost/usr/include/boost/boost/version.hpp" cannot be read.

How can I fix that please ?


Viewing all articles
Browse latest Browse all 98994

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>