Author Topic: Very VERY new to this, but can't find the answer  (Read 5145 times)

Offline jacksdemise

  • Single posting newcomer
  • *
  • Posts: 5
  • So new to programming, it's not even funny.
    • Victory Gardens and Landscaping, LLC
Very VERY new to this, but can't find the answer
« on: September 03, 2015, 08:44:59 pm »
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.")
« Last Edit: September 03, 2015, 09:09:30 pm by jacksdemise »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Very VERY new to this, but can't find the answer
« Reply #1 on: September 03, 2015, 09:31:18 pm »
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.
« Last Edit: September 03, 2015, 09:34:14 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline jacksdemise

  • Single posting newcomer
  • *
  • Posts: 5
  • So new to programming, it's not even funny.
    • Victory Gardens and Landscaping, LLC
Re: Very VERY new to this, but can't find the answer
« Reply #2 on: September 03, 2015, 09:52:50 pm »
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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Very VERY new to this, but can't find the answer
« Reply #3 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" !

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.

« Last Edit: September 03, 2015, 10:13:34 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline jacksdemise

  • Single posting newcomer
  • *
  • Posts: 5
  • So new to programming, it's not even funny.
    • Victory Gardens and Landscaping, LLC
Re: Very VERY new to this, but can't find the answer
« Reply #4 on: September 03, 2015, 10:16:57 pm »
DO NOT PM me!

Post a full build log!!

Edit: There is a difference between project "Build Options" and "Properties" !

Tim S.

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.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Very VERY new to this, but can't find the answer
« Reply #5 on: September 03, 2015, 10:32:30 pm »
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.

Please calm down or you get banned from the forum !!
You are the one that asked for help, Tim is the one who tried to do so.
So what's your problem ?

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.

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.
That's what you wrote, so please don't say you did exactly what Tim said.

Either you did not tell the truth in your first post or in the other !

And if you do not have "Project -> Properties -> Build targets -> Selected build target options" you must have a very special version of Code::Blocks.

Please try it again (to find these options) and post the settings there.

Offline jacksdemise

  • Single posting newcomer
  • *
  • Posts: 5
  • So new to programming, it's not even funny.
    • Victory Gardens and Landscaping, LLC
Re: Very VERY new to this, but can't find the answer
« Reply #6 on: September 03, 2015, 10:40:47 pm »
Ha!
Ya know what? Forget it.
You tell me to calm down when your own people are the ones typing in all caps and using double exclamation points.
I told you in the beginning that I'm new to this, and you've been utterly useless in helping me out.
I'll gladly work it out on my own or go elsewhere for help.

What \n
a n\
joke.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Very VERY new to this, but can't find the answer
« Reply #7 on: September 03, 2015, 10:57:59 pm »
Ha!
Ya know what? Forget it.
You tell me to calm down when your own people are the ones typing in all caps and using double exclamation points.
I told you in the beginning that I'm new to this, and you've been utterly useless in helping me out.
I'll gladly work it out on my own or go elsewhere for help.

What \n
a n\
joke.

I know I'm evil, that's my job as moderator in this forum.

Nevertheless, if you really want help, just give the needed information instead of trying to say that nobody wants to help you.
It's impossible to help you, if you do not give the information we need.

With such an attitude you will not get help in any serious forum, mailing-list or whatever.


Offline jacksdemise

  • Single posting newcomer
  • *
  • Posts: 5
  • So new to programming, it's not even funny.
    • Victory Gardens and Landscaping, LLC
Re: Very VERY new to this, but can't find the answer
« Reply #8 on: September 03, 2015, 11:11:16 pm »
Ha!
Ya know what? Forget it.
You tell me to calm down when your own people are the ones typing in all caps and using double exclamation points.
I told you in the beginning that I'm new to this, and you've been utterly useless in helping me out.
I'll gladly work it out on my own or go elsewhere for help.

What \n
a n\
joke.

I know I'm evil, that's my job as moderator in this forum.

Nevertheless, if you really want help, just give the needed information instead of trying to say that nobody wants to help you.
It's impossible to help you, if you do not give the information we need.

With such an attitude you will not get help in any serious forum, mailing-list or whatever.

No one called you evil, and I did what I could to provide the information necessary.
As I explained in the beginning, I'm new to all of this, so naturally, it would make sense for the people who are actually trying to help to approach the situation as one would a child. In other words without condescension, without typing in all caps or using multiple, emphatic punctuation which otherwise designates extreme [and unnecessary] emotion, and with - above all else - a spirit of understanding and patience.
Tim S. did everything - to the letter - that someone who is "trying to help" should not, so yeah, I got frustrated. In response, I sent him a private message to ensure that my emotions of frustration weren't smeared across the internet, and the response? Yelling and an utter lack of patience and understanding.

Moderate all you want, Jen. I'm calm as a cucumber at this point. I'm just saying that unless you put people on here who actually want to help, you're going to keep running into the same problems. People like Tim are the only reason people like you - the mods - are even necessary in the first place.

You're not evil. You're just not necessary if there's real help being offered.
Might suck to hear, but it is nevertheless accurate.

I received no help from you or Tim and will find my own way. Thank you, Tim, for absolutely nothing but demonstrating how not to be.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Very VERY new to this, but can't find the answer
« Reply #9 on: September 03, 2015, 11:36:02 pm »
I don't think it's worth the discussion, because it looks like you do not want any help, just trolling here.
Edit: Right click on the project and select properties.
Select tab: "Build Targets"
What is "type" set to under "Select build target options"?
I received no help from you or Tim and will find my own way. Thank you, Tim, for absolutely nothing but demonstrating how not to be.
You still did not answer this simple question.
How do you expect anybody to help you ?
Tim did not yell, except after your pm. I do not know what you wrote him, that should not make it into the public.
But I never send anybody I don't know a pm without asking him before.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Very VERY new to this, but can't find the answer
« Reply #10 on: September 04, 2015, 06:40:45 pm »
(i will enter this just for fun. because i have a good day today ^^)
Just a little reminder:
Post a full build log!!
and if you don't know how:
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
if this direction is not clear, then please ask what is not clear, so we can clear that up ;)

and the solution to your problem is probably:
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.
but we can't be sure unless you post the full build log, so we can't help you much.

a other possibility is that you have something in your compiler options that messes things up, but sadly my crystal ball is broken so i can't ask him, and we still need the build log...

(just my two cents)

greetings and have a nice day