#Undefined Reference WinMain
88 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
do you have int main(){}?
Yupp
do control +s and recompile
just use visual studio community than. you probably installed the compiler incorrectly
visual studio community sets up the compiler for you
vscode forces you to install mingw64 and set it up yourself
I installed the compiler from WinLib
WinLibs
it has to be an issue with the compiler
So, how do I download the compiler correctly?
use visual studio community, it just works (tm)
!solved
Thank you and let us know if you have any more questions!
This thread is now set to auto-hide after an hour of inactivity
A guy gets a basic error, and gets told to switch IDEs
You either don't actually have int main(), or are compiling some other file, not the one you think you do
if winMain isnt defined its an issue with the compiler, or int main isnt defined
maybe they are using a 32bit compiler in 64 bit system idk
I downloaded MinGW from WinLibs
MinGW-w64 GCC x86_64-posix-seh
This is the zip file
#include<iostream>
int main(){
std: : cout«"Hello";
return 0;
}
It's basically never a compiler issue, it means that either main or WinMain is missing
I have main in my code
posix?
you are compiling your app as a windows application and not console application. Windows App require a different entry point
You are probably compiling the wrong file then
Can you screenshot your terminal, with the command you're running and the output you're getting?
win+shift+s is the shortcut for it
This is a MSVC-only thing. MinGW supports both styles regardless of the subsystem
very useful
Ok wait!
I see
Please don't clip your screenshots so much
What am I doing wrong?
Make the terminal wider and show the entire contents
Include the filename above the code in your screenshot
Okk
show what files are on the left
Make sure to save your file first.
I have saved
isn't circle on the file meaning he has not?
No, the white dot indicates that it's not.
ye click on the file and do control +S
vscode doesn't save by default
you have to do it manually
you can toggle autosave tho
What did you do to save? Ctrl+S?
I opened the folder with vs code then created the file
We told you to press Ctrl+S, and you said you did that 
Press that and try compiling again
gotta toggle auto save
I thought VS code saves the file automatically
Okkkk
i usually toggle it for windowChangeFocus
Thank you so much 😊
Also it stops being a problem when you start using tasks for compilation, or some other mechanism. Tasks autosave automatically
shi i called it first too, did say control+s as one of the first things
Sorry 😅
its ok lil bro
Thank you so muchh
Btw, can you give me some tips for learning cpp
Okkk
We have Python in scl but I want to learn cpp 😅
programming is like telling someone instructions, except its like talking to someone who takes everything super literally
Yaa!!
Thank youuu
!solved