编译时对“WinMain@16"的未定义引用 [英] undefined reference to `WinMain@16' while compiling

查看:53
本文介绍了编译时对“WinMain@16"的未定义引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我刚刚安装了 VS code 并在出现此问题时尝试运行代码.通过网络搜索相关的答案,但没有一个工作.

So I just installed VS code and was trying to run a code when this came up. Searched through the web for a relevant answer but none worked.

这是控制台中更详细的输出:

Here is a more detailed output in the console:

cd "f:\" && g++ testing.cpp -o testing && "f:\"testing
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,

顺便说一下,我正在使用代码运行器来运行该单个文件.我已经设置了所有 MinGW 路径(不知道这是否重要).请有人帮忙.这是它的样子

By the way I am using code-runner to run that single file. I have MinGW path all set up( don't know if that even matters). Please, someone help.here is what it looks like

推荐答案

代码运行器在运行之前不会保存您的代码.你可以在你添加的错误片段中看到它执行的命令

The code runner does not save your code before running it. You can see the commands it executes in the error snippet you have added

cd "f:\" &&g++ testing.cpp -o testing &&"f:\"测试

cd "f:\" && g++ testing.cpp -o testing && "f:\"testing

因此请确保在运行之前保存您的代码.这发生在我身上,我浪费了很多时间.希望这会有所帮助.

So make sure you save your code before running it.This happened with me and I wasted quite some time.Hope this helps.

这篇关于编译时对“WinMain@16"的未定义引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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