初次用VC++6.0,编译通过了,可是link的时候出现了这个问题
------------------Configuration: CppTest - Win32 Debug--------------------
Linking...
CppTest.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall CppDyer::~CppDyer(void)" (??1CppDyer@@UAE@XZ)
CppTest.obj : error LNK2001: unresolved external symbol "public: void __thiscall CppDyer::processFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?processFile@CppDyer@@QAEXV?$basic_string@DU?$char_trait
s@D@std@@V?$allocator@D@2@@std@@@Z)
CppTest.obj : error LNK2001: unresolved external symbol "public: __thiscall CppDyer::CppDyer(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0CppDyer@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocat
or@D@2@@std@@@Z)
Debug/CppTest.exe : fatal error LNK1120: 3 unresolved externals
执行 link.exe 时出错.CppTest.exe - 1 error(s), 0 warning(s)
请大家指教~~。
------------------Configuration: CppTest - Win32 Debug--------------------
Linking...
CppTest.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall CppDyer::~CppDyer(void)" (??1CppDyer@@UAE@XZ)
CppTest.obj : error LNK2001: unresolved external symbol "public: void __thiscall CppDyer::processFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?processFile@CppDyer@@QAEXV?$basic_string@DU?$char_trait
s@D@std@@V?$allocator@D@2@@std@@@Z)
CppTest.obj : error LNK2001: unresolved external symbol "public: __thiscall CppDyer::CppDyer(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0CppDyer@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocat
or@D@2@@std@@@Z)
Debug/CppTest.exe : fatal error LNK1120: 3 unresolved externals
执行 link.exe 时出错.CppTest.exe - 1 error(s), 0 warning(s)
请大家指教~~。
#include "CppLex.h"
#include "CppDyer.h"
#include <sstream>
#include <fstream>
#include <iostream>using namespace std;
using namespace CppParser;class HtmlEncoder
{
int mPositionInLine;
bool mIsInFontTag;
string mLastColor;
public:
HtmlEncoder()
{
cout<<"<FONT FACE=\"Fixedsys\">";
mPositionInLine=0;
mIsInFontTag=false;
}
string encode(const string& s,const std::string& color)
{
std::string r;
if(mLastColor!=color)
{
mLastColor=color;
if(mIsInFontTag)
{
r+="</FONT><FONT COLOR=\"";
r+=color;
r+="\">";
}
else
{
r+="<FONT COLOR=\"";
r+=color;
r+="\">";
}
}
for(std::string::size_type i=0;i<s.size();++i)
{
if(s[i]=='\"')
r+=""";
else if(s[i]=='&')
r+="&";
else if(s[i]=='<')
r+="<";
else if(s[i]=='>')
r+=">";
else if(s[i]==' ')
r+=" ";
else if(s[i]=='\t')
{
for(int i=0;i<4-mPositionInLine%4;++i)
r+=" ";
mPositionInLine+=4-mPositionInLine%4;
continue;
}
else if(s[i]=='\n')
{
r+="<br>";
mPositionInLine=0;
continue;
}
else
r+=s[i];
++mPositionInLine;
}
return r;
}
string flush()
{
if(mIsInFontTag)
return "</FONT>";
cout<<"</FONT>";
}
};int main(int argc, char* argv[])
{
cerr<<"CppDyer 0.99 (c) by PolyRandom, all right reserved"<<endl;
cerr<<"This version is for debug only, please check"<<endl;
cerr<<"http://www.polyrandom.com/"<<endl;
cerr<<"for bug report and latest versions"<<endl;
cerr<<endl;
if(argc!=3)
{
cerr<<"USAGE: CppDyer <ini file name> <cpp file name>"<<endl;
return 0;
}
cerr<<"Converting..."<<endl;
try
{
CppDyer cd(argv[1]);
cd.processFile(argv[2]);
cerr<<"done"<<endl;
}
catch(...)
{
cerr<<"failed"<<endl;
}
return 0;
}
主程序是这个请大家指教一下吧
project-->setting-->link-->object/model