xml 解析に PugiXml を使用する静的ライブラリを作成しています。Visual Studio 2010 からのリンカー出力を次に示します (読みやすくするために記号を省略記号に置き換えました)。
error LNK2019: unresolved external symbol "public: __thiscall Dae_Library<class Dae_Geometry>::Dae_Library<class Dae_Geometry>(void)" (...) referenced in function "private: bool __thiscall Dae_Doc::ParseDae(void)" (...)
error LNK2019: ^ "public: wchar_t const * __thiscall pugi::xml_node::name(void)const " (...) referenced in function "private: bool __thiscall Dae_Doc::ParseDae(void)" (...)
error LNK2001: ^ "public: wchar_t const * __thiscall pugi::xml_node::name(void)const " (...)
error LNK2019: ^ "public: wchar_t const * __thiscall pugi::xml_attribute::value(void)const " (...) referenced in function "public: void __thiscall Dae_Node::SetXmlNode(class pugi::xml_node &)" (...)
error LNK2019: ^ "public: class pugi::xml_attribute __thiscall pugi::xml_node::attribute(wchar_t const *)const " (...) referenced in function "public: void __thiscall Dae_Node::SetXmlNode(class pugi::xml_node &)" (...)
私が試したこと:
- テンプレート クラスを明示的にインスタンス化します。
- PugiXml ソースをテスト プロジェクトにリンクします (現在、ビルド中の静的ライブラリに含まれています)。
- PugiXml を静的ライブラリとしてビルドし、ライブラリ プロジェクトとテスト プロジェクトの両方で参照する
- 私の純粋な仮想関数の代わりに何もしない関数を書く。
- pugixml をまったく参照しないデフォルトのコンストラクターを提供する
これは、過去 2 日間、私を夢中にさせており、どうすればよいか本当にわかりません。誰かが私に何か指示を与えることができれば、私はそれを大いに感謝します!
編集: pugixml を使用する単純な静的ライブラリを作成すると、コンパイルとテストが正常に行われることに注意してください。そのため、テンプレートとクラスの記述方法に問題がある可能性があります。