LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
我按照书上敲的程序,单个文件编译没问题,但是生成可执行文件时就出问题了。我刚学这个,大家帮帮忙,看看怎么解决这个问题//coordin.h
#ifndef COORDIN_H_
#define COORDIN_H_
struct polar
{
double distance;
double angle;
};
struct rect
{
double x;
double y;
};
polar rect_to_polar(rect xypos);
void show_polar(polar dapos);
#endif
//file1.cpp
#include <iostream>
#include "coordin.h"
using namespace std;
int main()
{
rect rplace;
polar pplace;
cout<<"Enter the x and y values: ";
while(cin>>rplace.x>>rplace.y)
{
pplace=rect_to_polar(rplace);
show_polar(pplace);
cout<<"Next two numbers (q to quit): ";
}
cout<<"Bye!\n";
return 0;
}
//file2.cpp
#include <iostream>
#include <cmath>
#include "coordin.h"
polar rect_to_polar(rect xypos)
{
using namespace std;
polar answer;
answer.distance=sqrt(xypos.x*xypos.x+xypos.y*xypos.y);
answer.angle=atan2(xypos.y,xypos.x);
return answer;
}
void show_polar(polar dapos)
{
using namespace std;
const double Rad_to_deg=57.29577951;
cout<<"distance = "<<dapos.distance;
cout<<", angle = "<<dapos.angle*Rad_to_deg;
cout<<" degrees\n";
}
我在编译file2的时候出现以下错误
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
这是什么意思。应该如何解决呢???