gpt4 book ai didi

c++ - 用 clang 和 libc++ 编译 cln

转载 作者:行者123 更新时间:2023-11-30 00:52:15 30 4
gpt4 key购买 nike

我尝试使用链接的 clang 和 libc++ 编译 cln 作为我的项目,它使用 ginac(它本身使用 cln)需要某些 c++11 功能。在我尝试的过程中,我发现,链接 libc++ 而不是 stdlibc++ 应该可以解决问题,所以我最终使用以下命令进行配置:

./configure CXX=/usr/bin/clang++ CXXFLAGS="-stdlib=libc++ -std=c++11" LDFLAGS="-stdlib=libc++"

效果很好。但是,我在调用 make 时收到以下错误消息:

Making all in src
/bin/sh ../libtool --tag=CXX --mode=compile /usr/bin/clang++ -DHAVE_CONFIG_H -I. - I../autoconf -I../include -I../src -I../include -I../src -stdlib=libc++ -std=c++11 -MT cl_alloca.lo -MD -MP -MF .deps/cl_alloca.Tpo -c -o cl_alloca.lo `test -f 'base/cl_alloca.cc' || echo './'`base/cl_alloca.cc
libtool: compile: /usr/bin/clang++ -DHAVE_CONFIG_H -I. -I../autoconf -I../include - I../src -I../include -I../src -stdlib=libc++ -std=c++11 -MT cl_alloca.lo -MD -MP -MF .deps/cl_alloca.Tpo -c base/cl_alloca.cc -fno-common -DPIC -o .libs/cl_alloca.o
In file included from base/cl_alloca.cc:4:
In file included from ./base/cl_sysdep.h:56:
In file included from ./base/cl_macros.h:7:
../include/cln/exception.h:14:24: error: implicit instantiation of undefined template 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >'
: std::runtime_error(std::string()) {}
^
/usr/bin/../lib/c++/v1/iosfwd:187:28: note: template is declared here
class _LIBCPP_TYPE_VIS basic_string;
^
1 error generated.
make[1]: *** [cl_alloca.lo] Error 1
make: *** [all-recursive] Error 1

我做错了什么,我该如何解释这个错误消息并最终解决我的问题?

最佳答案

在 include/cln/exception.h 中,include <string> :

// Exception types.

#ifndef _CL_EXCEPTION_H
#define _CL_EXCEPTION_H

#include <stdexcept>
+ #include <string>

namespace cln {

这只是 cln/exception.h 中的一个错误。

关于c++ - 用 clang 和 libc++ 编译 cln,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19456626/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com