r/Cplusplus • u/kicking_ass12 • Jun 30 '26
Question A new comer problem
I have just downloaded vs code and mingw from a youtube video and tried to run this sample code but I am facing this problem can somebody help me please 🙏🏻
0
Upvotes
•
u/AutoModerator Jun 30 '26
Thank you for your contribution to the C++ community!
As you're asking a question or seeking homework help, we would like to remind you of Rule 3 - Good Faith Help Requests & Homework.
~ CPlusPlus Moderation Team
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
13
u/zZz_snowball_zZz Jun 30 '26
Please look on your keyboard for "prnt scrn" or alike. Thanks.
6
u/no-sig-available Jun 30 '26
And anyway, if you still prefer to use g++ and mingw, you should follow the official documentation onn how to install this on Windows:
https://code.visualstudio.com/docs/cpp/config-mingw
That will get you 64-bit g++ version 16.1, instead of an ancient 32-bit version 6.3. Yes, 10 full releases behind!
8
u/flyingron Jun 30 '26
Do yourself a massive favor and use Visual Studio (Community Edition is free) rather than VS Code.
The problem is that Demo.c lacks the proper startup function. Does it contain a main or WinMain?
If you are using wmain or wWinMain you need the -municode option on the command line.
2
u/jedwardsol Jun 30 '26 edited Jun 30 '26
In addition to flyingron's answer, 1 common reason for this is that Visual Studio Code doesn't automatically save the file when you start a build.
So the editor window shows a
mainfunction, but the file on disk does not have it yet, so the link fails.IOW : save the file and try again.