1

mingw-w64 (4.8.0) + cmake を使用して、yaml-cpp (0.5.1) の共有ライブラリを構築しています。プロジェクトには、付属の CMakeLists.txt にいくつかのビルド ターゲットがあります。メイン ライブラリと、ライブラリをリンクするyaml-cppなどのテスト プログラムです。parse

ライブラリ ターゲット自体はエラーなしでビルドされましたが、ビルドyaml-cpp時に次のエラーが続きます。parse

Linking CXX executable parse.exe
CMakeFiles\parse.dir/objects.a(parse.cpp.obj):parse.cpp:(.text+0x1a3): undefined reference to `YAML::Load(std::istream&)'
CMakeFiles\parse.dir/objects.a(parse.cpp.obj):parse.cpp:(.text+0x1b2): undefined reference to `YAML::operator<<(std::ostream&, YAML::Node const&)'
c:/work/mingw64-4.8/bin/../lib/gcc/x86_64-w64-mingw32/4.8.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\parse.dir/objects.a(parse.cpp.obj): bad reloc address 0x0 in section `.data'
collect2.exe: error: ld returned 1 exit status
util\CMakeFiles\parse.dir\build.make:90: recipe for target 'util/parse.exe' failed
mingw32-make[3]: *** [util/parse.exe] Error 1
CMakeFiles\Makefile2:228: recipe for target 'util/CMakeFiles/parse.dir/all' failed
mingw32-make[2]: *** [util/CMakeFiles/parse.dir/all] Error 2
CMakeFiles\Makefile2:240: recipe for target 'util/CMakeFiles/parse.dir/rule' failed
mingw32-make[1]: *** [util/CMakeFiles/parse.dir/rule] Error 2
makefile:211: recipe for target 'parse' failed
mingw32-make: *** [parse] Error 2

ライブラリを使用して小さなテスト プログラムを作成しようとすると、同様のエラーが発生しますが、何が問題なのかわかりません。ここで何が問題になる可能性がありますか?

4

1 に答える 1

1

Jesse Beder のコメントは、質問で説明されているエラーの原因となっている正確な問題を示しています。これがフォローアップ リリースで修正される間の簡単な修正は、パッチ ( https://code.google.com/p/yaml-cpp/issues/detail?id=216#c4 ) をクリーン コピーに適用することです。 yaml-cpp 0.5.1。コメントアウトする必要がstd::string node_data::empty_scalarあるソース ファイルで宣言する行もあります。src/node_data.cppこれらの変更を行った後、共有ライブラリとユーティリティはエラーなしでビルドされます。

于 2013-08-24T01:33:14.350 に答える