GTSAM 在安装过程中可能出现的错误

编译过程中可能提示的错误如下:

Q1:cmake .. 编译中出现的错误:

CMake Error at wrap/CMakeLists.txt:29 (target_link_libraries):

  The "debug" argument must be followed by a library.

解决方法:找到gtsam/wrap/CMakeLists 文件 把以下内容注释或者删除(第8-11行):

debug

  ${Boost_FILESYSTEM_LIBRARY_DEBUG}

  ${Boost_SYSTEM_LIBRARY_DEBUG}

  ${Boost_THREAD_LIBRARY_DEBUG}

Q2:cmake .. 编译中出现的错误

CMake Error at gtsam/CMakeLists.txt:105 (target_link_libraries):

  The "debug" argument must be followed by a library.

解决方法:注释或删掉gtsam/CMakeLists文件中的2处代码(第174-180行、第192-194行)

  debug

    ${Boost_SERIALIZATION_LIBRARY_DEBUG}

    ${Boost_SYSTEM_LIBRARY_DEBUG}

    ${Boost_FILESYSTEM_LIBRARY_DEBUG}

    ${Boost_THREAD_LIBRARY_DEBUG}

    ${Boost_DATE_TIME_LIBRARY_DEBUG}

    ${Boost_REGEX_LIBRARY_DEBUG}

        debug

          ${Boost_TIMER_LIBRARY_DEBUG}

          ${Boost_CHRONO_LIBRARY_DEBUG}

  • 7
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
To link a C++ shared library, you need to follow these steps: 1. Compile your C++ code into an object file using the `-c` flag. For example, if your C++ code is in a file called `mylibrary.cpp`, you would run the following command: `g++ -c -fPIC mylibrary.cpp` The `-fPIC` flag is necessary to generate Position Independent Code, which is needed for shared libraries. 2. Link the object file into a shared library using the `-shared` flag. For example, if your object file is called `mylibrary.o`, you would run the following command: `g++ -shared -o libmylibrary.so mylibrary.o` The `-o` flag specifies the output file name, and the `.so` extension is used for shared libraries on Linux. 3. Include the shared library in your project by specifying the library name and location in your build system. For example, if you are using CMake, you would add the following lines to your `CMakeLists.txt` file: ``` add_library(mylibrary SHARED IMPORTED) set_target_properties(mylibrary PROPERTIES IMPORTED_LOCATION /path/to/libmylibrary.so) ``` This tells CMake to import the `mylibrary` shared library and set its location to `/path/to/libmylibrary.so`. 4. Use the functions and classes defined in the shared library in your code by including the appropriate header files and linking against the library. For example, if your library defines a function called `myfunction`, you would include its header file and link against the library like this: ``` #include "mylibrary.h" ... myfunction(); ``` And in your build system, you would specify the library as a dependency: ``` target_link_libraries(myprogram mylibrary) ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值