我正在使用Mac。我有一个用C ++编写的库,我们称之为“wibble”,以及它的源代码。我可以使用GCC 4.3从macports(g++-mp-4.3
)编译此源代码,只要我使用GCC 4.3,就可以将生成的库链接到其他内容。
但是,我需要将它链接到另一个应用程序(我们称之为“blort”),它只会加载与OS X 10.6捆绑在一起的GCC 4.2编译的库(因为那就是 it 是建造的)
我可以或多或少地混淆wibble Makefile
然而我可能会喜欢,但是blort是一个固定的目标。我可以编写任何代码或构建脚本来将它们粘合在一起我可能需要。似乎没有办法在4.2上编译(除非重写,这是不可能的),并且编写它的人证实了这一点。
我对C ++中的整个构建和链接过程并不十分熟悉,只是已经完成了这种集成,并且完全被困住了。我正在努力实现的目标是什么?如果是这样,怎么样?
如果重要的话,我要做的就是通过Inline::CPP从Perl调用wibble中的方法,但是如果必须的话,我愿意写原始的XS(我已经完成了那之前,至少)。我需要使用perl系统,这样可以轻松地在其他人的机器上构建和安装。 : - /
更新,2012-03-01,1
我正在研究使用Mac的编译器编译protobufs,并看看我是否可以使用相同的编译器使用该构建的protobufs进行编译。我将很快发布结果。
Hrmph 同样的错误:
g++ -Wall -Wno-unused-function -Wno-long-long -pedantic -O3 -I/Users/sscaffid/local/include -L/Users/sscaffid/local/lib -fPIC -std=c++98 -c wire.pb.cc
In file included from /Users/sscaffid/local/include/google/protobuf/wire_format_lite_inl.h:43,
from wire.pb.cc:10:
/Users/sscaffid/local/include/google/protobuf/wire_format_lite.h:94: error: comma at end of enumerator list
/Users/sscaffid/local/include/google/protobuf/wire_format_lite.h:117: error: comma at end of enumerator list
/Users/sscaffid/local/include/google/protobuf/wire_format_lite.h:132: error: comma at end of enumerator list
In file included from wire.pb.cc:10:
/Users/sscaffid/local/include/google/protobuf/wire_format_lite_inl.h:303: error: extra ‘;’
/Users/sscaffid/local/include/google/protobuf/wire_format_lite_inl.h:304: error: extra ‘;’
/Users/sscaffid/local/include/google/protobuf/wire_format_lite_inl.h:305: error: extra ‘;’
/Users/sscaffid/local/include/google/protobuf/wire_format_lite_inl.h:306: error: extra ‘;’
/Users/sscaffid/local/include/google/protobuf/wire_format_lite_inl.h:307: error: extra ‘;’
/Users/sscaffid/local/include/google/protobuf/wire_format_lite_inl.h:308: error: extra ‘;’
In file included from wire.pb.cc:11:
/Users/sscaffid/local/include/google/protobuf/descriptor.h:322: error: comma at end of enumerator list
/Users/sscaffid/local/include/google/protobuf/descriptor.h:341: error: comma at end of enumerator list
/Users/sscaffid/local/include/google/protobuf/descriptor.h:352: error: comma at end of enumerator list
/Users/sscaffid/local/include/google/protobuf/descriptor.h:1206: error: extra ‘;’
/Users/sscaffid/local/include/google/protobuf/descriptor.h:1223: error: extra ‘;’
/Users/sscaffid/local/include/google/protobuf/descriptor.h:1243: error: extra ‘;’
/Users/sscaffid/local/include/google/protobuf/descriptor.h:1249: error: extra ‘;’
/Users/sscaffid/local/include/google/protobuf/descriptor.h:1257: error: extra ‘;’
/Users/sscaffid/local/include/google/protobuf/descriptor.h:1264: error: extra ‘;’
/Users/sscaffid/local/include/google/protobuf/descriptor.h:1274: error: extra ‘;’
In file included from wire.pb.cc:13:
/Users/sscaffid/local/include/google/protobuf/wire_format.h:226: error: comma at end of enumerator list
make: *** [wire.pb.o] Error 1
答案 0 :(得分:-1)
从问题:
使用-pedantic
选项加入GCC 4.2会对protobuf
代码感到非常生气。不要使用它。