User forums > Help
Very VERY new to this, but can't find the answer
jacksdemise:
I am running Code::Blocks version Code::Blocks 13:12 (as far as I can tell) on an Windows 10.
The compiler I use is GNU GCC, and I have no idea what the compiler version number is. I downloaded the IDE today, so whatever comes as the default download.
When I tried to run a very basic program, I get "Undefined reference to 'WinMain@16'" with a failed build even though I built the entire program based on a tutorial I was watching as it typed it up. The tutorial worked, mine didn't.
mingw32-g++.exe -Wall -fexceptions -g -I -c "C:\Users\User\Desktop\TrialProject\Trial Project\Trial Project.cpp" -o obj\Debug\burritos.o
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../libmingw32.a(main.o):main.c:(.text.startup+0xa7): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
I have already looked through the forums and FAQ sections already, but none of the answers provided help me to understand what's going wrong. I have checked and double checked my work against the work provided in the tutorial I was watching, and it's all completely identical. I'm sure part of the problem is that I don't understand half of the things being said in either location, and I understand even less regarding the proposed solutions, but I'm trying to learn, and this has me completely stuck.
Any help anyone can offer would be greatly appreciated.
Update: I just tried deleting the entire project and starting over from scratch, and it's now saying there's an undefined reference to my class file. In the tutorial, I noticed that there were a couple of options checked on my window which didn't even exist in the tutorial's window. Is it possible that having one of those boxes checked could be causing the problem? (The checked boxes are "Add paths to project" and "Use relative path.")
stahta01:
1. You need to learn how to post a full build log on these types of problem.
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
IIRC, "undefined reference to WinMain@16" tends to happen when you pick the wrong project type.
Normally simple CB projects are GUI or console type projects.
Likely you picked the wrong one.
Edit: Right click on the project and select properties.
Select tab: "Build Targets"
What is "type" set to under "Select build target options"?
Tim S.
jacksdemise:
Edit: Right click on the project and select properties.
Select tab: "Build Targets"
What is "type" set to under "Select build target options"?
Tim S.
[/quote]
i see nothing that says, "Select build target options." I do see "Build Options" and under that tab only "Produce debegging symbols (-g)" is checked.
stahta01:
DO NOT PM me!
Post a full build log!!
Edit: There is a difference between project "Build Options" and "Properties" !
Edit2: Step 2 is to learn the difference between Compiling and Linking.
You posted the link command; you did NOT post the compile command that would be in a full build log!
Tim S.
jacksdemise:
--- Quote from: stahta01 on September 03, 2015, 10:08:48 pm ---DO NOT PM me!
Post a full build log!!
Edit: There is a difference between project "Build Options" and "Properties" !
Tim S.
--- End quote ---
Honestly, Tim, I'm not sure why someone who clearly isn't interested in actually helping people is responding to aid requests in the first place. I private messaged you, because I didn't think my laying into you for being something of an a-hole would be appropriate on the public forum page, but since you seem intent on proving that point anyway, fine. I WON'T PM you.
In reference to the other problem, I did exactly what you said: Right clicked my project, selected 'Properties,' selected the 'Build Targets' tab, and from there I have no option of selecting anything to do with build targets. Your move.
Navigation
[0] Message Index
[#] Next page
Go to full version