在vsc C ++中运行hello world时出错 [英] Getting error while running hello world in vsc C++

查看:179
本文介绍了在vsc C ++中运行hello world时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行时



when i run this

#include <iostream>

int main(){
cout << "hello world" << endl;
return 0;
}





i得到此错误





i get this error

c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status

[Done] exited with code=1 in 0.83 seconds





我的尝试:



i尝试重新安装一切,但它工作



What I have tried:

i tried reinstalling everything but it dint work

推荐答案

WinMain是Windows进程的入口点。 main是控制台进程的入口点。您需要使用编译器来定位控制台进程。
WinMain is the entry point for a windows process. main is the entry point for a console process. You need to target a console process with your compiler.


这篇关于在vsc C ++中运行hello world时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆