Visual Studio 2010 MFC - Unicode - 共享DLL中的MFC - / SUBSYSTEM:WINDOWS
//cword.hpp
//---------
#pragma once
#include <atlstr.h>
class CWord
{
public:
CWord();
CWord(const CString word);
~CWord();
};
//cword.cpp
//---------
#include "CWord.h"
CWord::CWord() { }
CWord::CWord(const CString word)
{
m_word = word;
}
//"CWordSearchDoc.h
-------------------
#include <vector>
#include "CWord.h"
class CWordSearchDoc : public CDocument
{
private:
std::vector< CWord > m_word_list;
public:
void add_word(CString word);
};
//"CWordSearchDoc.cpp
//-------------------
#include "CWordSearchDoc.h"
void CWordSearchDoc::add_word(CString word)
{
CWord new_word( word );
m_word_list.push_back( new_word ); // -- link error LNK2019
// ......
m_word_list.push_back( CWord() ); // -- no error
}
1&gt; CWordsearchDoc.obj:错误LNK2019:未解析的外部符号&#34; public:__ thiscall CWord :: CWord(类ATL :: CStringT&gt;&gt;)&#34; (?? 0CWord @@ QAE @ V'$ @ CStringT _WV?$ @ StrTraitMFC_DLL _WV?$ @ ChTraitsCRT @ _W ATL @@@@@ ATL @@@ Z) 在函数&#34; public中引用:void __thiscall CWordSearchDoc :: add_word(类ATL :: CStringT&gt;&gt;)&#34; (?add_word @ @@ CWordSearchDoc QAEXV?$ CStringT @ _WV?$ StrTraitMFC_DLL @ _WV?$ ChTraitsCRT @ _W @ ATL @@@@@ ATL @@@ Z)
在dos应用程序中复制了相同的代码并且发生了同样的错误。任何帮助表示感谢。 :)