追忆lh 发表于 2014-9-28 14:10:16

C++中自己编写的头文件包含到源文件后总出错

//fenge.h

#ifndef GUARD_fenge_h
#define GUARD_fenge_h
#include <vector>
#include <string>
std::vector <std::string> split ( const std::string& );
#endif


//fenge.cpp

#include <cctype>
#include "fenge.h"

using namespace std;
vector <string> split (const string& s)
{
vector <string> ret;
typedef string::size_type string_size;
string_size i =0;
while(i != s.size())
{
   while (i != s.size() && isspace (s))
   ++i;
string_size j=i;
while (j!=s.size() && !isspace(s))
         ++j;
if (i!= j)
{ret.push_back(s.substr (i,j-i));
i=j;}
}
return ret;
}


compile 没问题,但是build会出错,问题如下:
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/fenge.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
fenge.exe - 2 error(s), 0 warning(s)

望各位大神多多帮忙啊

页: [1]
查看完整版本: C++中自己编写的头文件包含到源文件后总出错