他のモジュール (exe および dll) で使用されることになっているコンストラクターと共にクラスを公開するライブラリー (dll) があります。そのクラスを他のライブラリ モジュールからインスタンス化することはできますが、exe モジュールからインスタンス化することはできません。リンク中に「エラー LNK2019: 未解決の外部シンボル」というリンカ エラーが発生します。exe プロジェクトではなく、他のライブラリ プロジェクトで使用するとリンクが成功する理由がわかりません。誰かがこれで私を助けることができますか?
以下はクラス宣言です。
class __declspec(dllimport) MyException
{
public:
MyException(unsigned int _line, const char *_file, const char *_function, MyExceptionType _type, const wchar_t* _message = 0, ...);
};
これはエラー全体です: error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl MyException::MyException(unsigned int,char const *,char const *,enum MyException::MyExceptionType,unsigned short const *,... )" (_ imp ??0MyException@@QAA@IPBD0W4MyExceptionType@0@PBGZZ) 関数で参照される "public: __thiscall MyClassUsesMyException::MyClassUsesMyException(class SomeClass *,int)" (??0MyClassUsesMyException@@QAE@PAVSomeClass@@H@ Z)
MyClassUsesMyException は 'MyApp.cpp' でインスタンス化されています。
ありがとう、ラケシュ。