首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >构建libsigc++失败(std::basic_ostream显式实例化)

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

Stack Overflow用户
提问于 2013-03-05 20:58:04
回答 1查看 473关注 0票数 1

我正试着在mac 10.8 (山狮)上安装热情(http://ardour.org)的依赖,根据这个页面:native.html

有两个脚本是由热情的开发人员编写的:

  • build堆栈(gtk+,glib,pango,cairo.)
  • 建立热情堆栈(boost,rapto,libvorbis.)

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

我在构建热情堆栈脚本上遇到了麻烦,尤其是构建libsigc++。

我发现了这个痕迹:

代码语言:javascript
复制
[...]
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:

代码语言:javascript
复制
#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:

代码语言:javascript
复制
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00).

你认为如何?

谢谢!

EN

回答 1

Stack Overflow用户

发布于 2013-03-31 21:40:30

我问libsigc++开发人员使用他们的邮件列表。我把他们要我尝试的解决方案发到这里。就我而言,他们中没有一个人解决了这个问题:

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

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

我听说其他一些人成功地编写了我想要的东西。它在相同版本的mac操作系统下(10.8)。看来问题出在我身上..。

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

https://stackoverflow.com/questions/15233978

复制
相关文章

相似问题

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