0

静的エラー:

   in test1.dll:
    xxx.h
    class AFX_EXT_CLASS CTest1
    {
        static int num;
    }

    xxx.cpp
    int CTest1::num = 0;

    in a cpp of test2.dll: test2 is dependent test1.dll
    ...
    int i = CTest1::num;
    ...

    in a cpp of App: App is dependent test1.dll & test2.dll
    ...
    int i = CTest1::num;
    ...

test2.dll で、静的に「未解決の外部シンボル」: CTest1::num。アプリでは問題ありません。

ところで: CTest1 の他の機能を使用しても問題ありません。

助けてください、どうもありがとう。

4

1 に答える 1

0

コンパイラはシンボルを削除しています。試すことができ__declspecimportます。extern変数を試して、別のプロジェクトで人為的な参照を作成することもできます。

于 2013-04-29T15:43:43.240 に答える