0
`WinMain@16'
its been along time trying to fix this problem when making a c++ program using classes (header and cpp) i am getting this error (( undefined reference to `WinMain@16' )) i tried everything and just nothing is working //this problem happened to me before and i was solving it by restarting Code::block but now this is not working...
12 Respostas
+ 9
This error code sounds like when you are trying to compile an empty source code and the compiler can't find your main(). Same thoughts with @ChaoticDawg. But the code you provided doesn't reflect this error. :<
+ 7
Well, if other compilers say the code is fine and your particular compiler or IDE is complaining, methinks it's time to get a new IDE lol. (Or reinstall it?)
I really don't know what would fix the problem, because I run DevC++ (5.11), some VS, just not Code::Blocks.
+ 5
You didn't #include <windows.h>?
+ 4
Does your program have a main() function?
Can you post your code?
+ 4
@Chaotic is right.
The best way for you to get help is to post your code.
+ 2
@Hasty the code does have a main(), but if it was just copied and pasted into one cpp file would error (not necessarily this error). Windows with Codeblocks can give this error if the project type is wrong, or if the compiler settings are wrong with mingw.
+ 1
Ok, so the code itself is good. It does compile and run. So you most likely have a project, compiler or IDE settings issue. Can you create a new C++ console application like the built in "Hello, World" compile and run it? If so is your file configuration correct? See the project here: https://goo.gl/tQwq3t
You can even download the project and try it that way.
+ 1
So if your hello world console application is working fine (compiles, runs, and outputs Hello World) then what if any are the differences if you just had an empty main. Are there any other/different include statements? Is the signature of main the same? Was the project you created with the copied/downloaded code made as a console application?
If you copy the code from the main.cpp into the hello world projects main.cpp and then add the other files to the project do you get the same issue?
0
this code that i found in a lesson's comments..
https://justpaste.it/169sw
it is on "more on classes"module>composition part 2>last one
0
i tried to copy the code @chaoticdawg it didnt work
also i downloaded it.same.
//console applications working fine
//when i compile it on the website it worked fine and showed the correct output
●so i should maybe reinstalling codeblocks?
0
it is so messed up!