gpt4 book ai didi

c++ - 构建 libsigc++ 失败(std::basic_ostream 显式实例化)

转载 作者:太空宇宙 更新时间:2023-11-04 11:58:09 25 4
gpt4 key购买 nike

我正在尝试根据此页面在 mac os 10.8 (Mountain Lion) 上安装 ardor ( http://ardour.org) 依赖项:http://ardour.org/building_osx_native.html .

ardor 开发人员制作了两个脚本来执行此操作:

  • build-gtk-stack(gtk+、glib、pango、cairo...)
  • build-ardour-stack(boost、rapto、libvorbis...)

它们可以在 subversion.ardour.org/svn/ardour2/branches/2.0-ongoing/tools/中找到。

我在使用 build-ardour-stack 脚本时遇到问题,尤其是在构建 libsigc++ 时。

我有这个痕迹:

[...]
libtool: compile: g++ -DHAVE_CONFIG_H -I.. -I.. -Wall -g -O2 -MT adaptors/lambda/lambda.lo -MD -MP -MF adaptors/lambda/.deps/lambda.Tpo -c adaptors/lambda/lambda.cc -fno-common -DPIC -o adaptors/lambda/.libs/lambda.o
/bin/sh ../libtool --tag=CXX --mode=link g++ -Wall -g -O2 -no-undefined -version-info 0:0:0 -headerpad_max_install_names -o libsigc-2.0.la -rpath /Users/maxime/a3/inst/lib signal.lo signal_base.lo trackable.lo connection.lo functors/slot.lo functors/slot_base.lo adaptors/lambda/lambda.lo
libtool: link: g++ -dynamiclib -o .libs/libsigc-2.0.0.dylib .libs/signal.o .libs/signal_base.o .libs/trackable.o .libs/connection.o functors/.libs/slot.o functors/.libs/slot_base.o adaptors/lambda/.libs/lambda.o -O2 -install_name /Users/maxime/a3/inst/lib/libsigc-2.0.0.dylib -compatibility_version 1 -current_version 1.0 -Wl,-single_module
libtool: link: (cd ".libs" && rm -f "libsigc-2.0.dylib" && ln -s "libsigc-2.0.0.dylib" "libsigc-2.0.dylib")
libtool: link: ( cd ".libs" && rm -f "libsigc-2.0.la" && ln -s "../libsigc-2.0.la" "libsigc-2.0.la" )
Making all in tests
make[2]: Nothing to be done for `all'.
Making all in examples
g++ -DHAVE_CONFIG_H -I.. -I.. -Wall -g -O2 -MT hello_world.o -MD -MP -MF .deps/hello_world.Tpo -c -o hello_world.o hello_world.cc
g++ -DHAVE_CONFIG_H -I.. -I.. -Wall -g -O2 -MT member_method.o -MD -MP -MF .deps/member_method.Tpo -c -o member_method.o member_method.cc
hello_world.cc: In instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’:
hello_world.cc:18: instantiated from here
hello_world.cc:18: error: explicit instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’ but no definition available
hello_world.cc: In instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’:
hello_world.cc:18: instantiated from here
hello_world.cc:18: error: explicit instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’ but no definition available
hello_world.cc: In instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’:
hello_world.cc:18: instantiated from here
hello_world.cc:18: error: explicit instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’ but no definition available
make[2]: *** [hello_world.o] Error 1
make[2]: *** Waiting for unfinished jobs....
mv -f .deps/member_method.Tpo .deps/member_method.Po
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
libsigcpp build failed

hello_world.cc :

#include <iostream>
#include <string>
#include <sigc++/sigc++.h>

SIGC_USING_STD(cout)
SIGC_USING_STD(endl)
SIGC_USING_STD(string)

void on_print(const std::string& str)
{
std::cout << str;
}

int main()
{
sigc::signal<void, const std::string&> signal_print;
signal_print.connect( sigc::ptr_fun(&on_print) );
signal_print.emit("hello world\n");
return 0;
}

我的 gcc 是:

i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00).

你怎么看?

谢谢!

最佳答案

我使用他们的邮件列表询问了 libsigc++ 开发人员。我在这里发布了他们要求我尝试的解决方案。就我而言,他们都没有解决问题:

  • 删除 SIGC_USING_STD 宏
  • -std=c++0x 编译器标志
  • 在makefile中注释掉hello_world.cc

我还尝试向编译器添加以下选项:-mmacosx-version-min=10.8。

我听说其他一些人在编译我尝试的东西时取得了成功。它在同一版本的 mac os (10.8) 下。所以看来问题出在我这边......

关于c++ - 构建 libsigc++ 失败(std::basic_ostream 显式实例化),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15233978/

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