首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >用GCC-6在克利恩建立Boost库的麻烦

用GCC-6在克利恩建立Boost库的麻烦
EN

Stack Overflow用户
提问于 2020-06-02 23:00:19
回答 1查看 104关注 0票数 0

我不能建立一个简单的Hello程序在GCC-6,但它的工作与Clang在克里昂。

现在我尝试在这里构建并运行第一个Boost日期时间示例。

Boost日期时间示例

我的CMake看起来就像

代码语言:javascript
复制
cmake_minimum_required(VERSION 3.16)
project(Boost_Run_2)

set(CMAKE_CXX_STANDARD 11)

find_package(Boost REQUIRED COMPONENTS date_time)

add_executable(Boost_Run_2 main.cpp)
target_link_libraries(Boost_Run_2 PRIVATE Boost::date_time)

但是它将链接器错误抛出为

代码语言:javascript
复制
====================[ Build | Boost_Run_2 | Debug ]=============================
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake --build /Users/alihasan/Documents/GSOC/Boost_Run_2/cmake-build-debug --target Boost_Run_2 -- -j 4
Scanning dependencies of target Boost_Run_2
[ 50%] Building CXX object CMakeFiles/Boost_Run_2.dir/main.cpp.o
[100%] Linking CXX executable Boost_Run_2
Undefined symbols for architecture x86_64:
  "boost::gregorian::greg_month::get_month_map_ptr[abi:cxx11]()", referenced from:
      unsigned short boost::date_time::month_str_to_ushort<boost::gregorian::greg_month>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in main.cpp.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[3]: *** [Boost_Run_2] Error 1
make[2]: *** [CMakeFiles/Boost_Run_2.dir/all] Error 2
make[1]: *** [CMakeFiles/Boost_Run_2.dir/rule] Error 2
make: *** [Boost_Run_2] Error 2

当我使用Clang运行相同的程序时,我能够运行它。没有链接错误。所以我假设我的助推图书馆已经被正确地设置好了。

我希望能够使用GCC-6/G++-6运行同一个程序.

我有一个macOS Mojave 10.14.3,我使用brew install boost安装Boost库。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-06-03 00:52:48

我解决了这个问题。

我意识到我的Boost库安装不正确。

出于某种原因,Homebrew没有正确安装Boost库,您必须按照文档中提到的方式安装它。

开始使用Unix变体

StackOverflow问如何在MacOS上安装Boost?

感谢蜗牛,回答,https://stackoverflow.com/a/11297605/8093027

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62162708

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档