1

Visual Studio 8 2005 で「yaml-cpp-0.3.0」を使用して dll を作成しようとすると、「INSTALL」、「run-tests」のリンク エラーが発生します。

エラー 1 エラー LNK2019: 未解決の外部シンボル "void __cdecl YAML::operator>>(class YAML::Node const &,class YAML::Binary &)" (??5YAML@@YAXABVNode@0@AAVBinary@0@@Z ) 関数で参照される "public: class YAML::Binary const __thiscall YAML::Node::to(void)const " (??$to@VBinary@YAML@@@Node@YAML@@QBE?BVBinary@1@XZ ) parsertests.obj

エラー 2 致命的なエラー LNK1120: 1 個の未解決の外部ファイル ....\yaml-cpp_dll\build\test\Debug\run-tests.exe 1

http://code.google.com/p/yaml-cpp/issues/detail?id=88でユーザーが言及した一般的な手順を使用して

  1. 「yaml-cpp-0.3.0」の cd yaml-cpp
  2. mkdir ビルド
  3. CDビルド
  4. cmake -DBUILD_SHARED_LIBS=ON -G "Visual Studio 8 2005" ..

これを修正する方法を探しています。どんな入力でも大歓迎です。

4

1 に答える 1

2

Visual Studio 9 2008 でも同じリンク エラーが発生しました。問題は、binary.h で宣言された >> 演算子がエクスポートされないことです。binary.h で次の変更を行った後、すべて正常に機能しました。

#include "yaml-cpp/dll.h"  // add a new include to have YAML_CPP_API defined

...

// add the missing YAML_CPP_API
YAML_CPP_API void operator >> (const Node& node, Binary& binary); 
于 2012-10-27T09:35:16.543 に答える