LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   underined reference to main (https://www.linuxquestions.org/questions/linux-newbie-8/underined-reference-to-main-789127/)

calmac10 02-14-2010 09:43 PM

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;
}
}

chrism01 02-14-2010 10:43 PM

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

smeezekitty 02-14-2010 10:46 PM

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(){}



All times are GMT -5. The time now is 04:38 AM.