求助:MSVCRTD.lib(crtexe.obj) : error LNK2019: 无法解析的外部符号 _main,该符号在函数 ___tmainCRTSt

edony 2013-11-30 10:33:18
#include<iostream>
#include<fstream>

int mian()
{
using namespace std;

char automobile[50];
int year;
double a_price;
double d_price;

ofstream outFile;//creat an object for output
outFile.open("carinfo.txt");//associate with a file

cout<<"Enter the make and model of automobile: ";
cin.get(automobile,50);
cout<<"Enter the model year: ";
cin>>year;
cout<<"Enter the original asking price: ";
cin>>a_price;
d_price=0.913*a_price;

cout<<fixed;
cout.precision(2);
cout.setf(ios_base::showpoint);
cout<<"Make and model: "<<automobile<<endl;
cout<<"Year: "<<year<<endl;
cout<<"Was asking $"<<a_price<<endl;
cout<<"Now asking $"<<d_price<<endl;

outFile<<fixed;
outFile.precision(2);
outFile.setf(ios_base::showpoint);
outFile<<"Make and model: "<<automobile<<endl;
outFile<<"Year: "<<year<<endl;
outFile<<"Was asking $"<<a_price<<endl;
outFile<<"Now asking $"<<d_price<<endl;

outFile.close();
return 0;

}


编译的时候出现问题:
1>------ 已启动生成: 项目: write2file, 配置: Debug Win32 ------
1> 源.cpp
1>MSVCRTD.lib(crtexe.obj) : error LNK2019: 无法解析的外部符号 _main,该符号在函数 ___tmainCRTStartup 中被引用
1>D:\Study\Engineering Program Study\Visual studio project\write2file\Debug\write2file.exe : fatal error LNK1120: 1 个无法解析的外部命令
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========


在度娘上查了一下解决办法不管用,控制台和app都试过了。请各位大神帮我看一下是什么问题?

多谢多谢!
...全文
613 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
上天啊 我的 也是 mian 写成 main 哎呀
光子乘羽 2014-10-25
  • 打赏
  • 举报
回复
我也遇到了同样的问题,但是我还没有加main
边走边瞧 2013-12-01
  • 打赏
  • 举报
回复
哎呀娘哎。
Adol1111 2013-12-01
  • 打赏
  • 举报
回复
引用 1 楼 dyw 的回复:
int mian() --> int main()
+1 楼主要看仔细,main才是合法的程序入口
dyw 2013-12-01
  • 打赏
  • 举报
回复
int mian() --> int main()

65,186

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧