LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-14-2010, 10:43 PM   #1
calmac10
LQ Newbie
 
Registered: Feb 2010
Posts: 1

Rep: Reputation: 0
underined reference to main


Hi I keep getting the error

/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status

I have no idea where I went wrong in my coding. Any help would be appericated.
Thanks

Here is my code



#include <iostream>

using namespace std;



double Whereis( const float Px,
const float Py
)

{
if ( (540 < Px < 640) and (150 < Py < 210) )
{
return 0 ;
}

else ( (440 < Px < 500) and (290 < Py < 350) )
{
cout << "your in Stadium" <<endl;
}
}
 
Old 02-14-2010, 11:43 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,260

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
Well, I've only done straight C, not C++, but I believe the main() fn is still required....
http://www.linfo.org/create_c1.html
 
Old 02-14-2010, 11:46 PM   #3
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,330

Rep: Reputation: 227Reputation: 227Reputation: 227
Ahhh...Ok...How about main?
Code:

#include <iostream>

using namespace std;



double Whereis( const float Px,
const float Py
)
{
if ( (540 < Px < 640) and (150 < Py < 210) )
{
return 0 ;
}

else ( (440 < Px < 500) and (290 < Py < 350) )
{
cout << "your in Stadium" <<endl;
}
}
main(){}
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting undefined reference to main error?? Mistro116@yahoo.com Programming 14 07-29-2011 09:28 AM
undefined reference to `main' otacon 14112 Programming 4 03-18-2008 05:23 PM
Undefined reference to 'main' myhanguk Programming 5 07-05-2007 04:32 AM
undefined reference to main () ?. rameshs Linux - Newbie 3 01-11-2007 07:29 PM
undefined reference to main cjbrockwell Programming 3 09-06-2006 06:09 PM


All times are GMT -5. The time now is 10:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration