Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » make: *** [main] Error 1
make: *** [main] Error 1 [message #783606] Thu, 26 January 2012 04:00 Go to next message
Jamie Gardiner is currently offline Jamie GardinerFriend
Messages: 4
Registered: January 2012
Junior Member
hey,

Does any one know what this means make: ***[main] Error 1? I have been trying to fix this issue over the last 2-3 days but I am unable to make any progress. I only have one ccp file in the program, but I am still unable to fix the issue.


Very frustrating.
  • Attachment: main.cpp
    (Size: 2.39KB, Downloaded 528 times)
Re: make: *** [main] Error 1 [message #783676 is a reply to message #783606] Thu, 26 January 2012 08:02 Go to previous messageGo to next message
Jamie Gardiner is currently offline Jamie GardinerFriend
Messages: 4
Registered: January 2012
Junior Member
The error message is actually Undefined symbols:"_main", referenced from: start in crt1.10.6.old: symbol(s) not found. I am still at odds
Re: make: *** [main] Error 1 [message #783700 is a reply to message #783676] Thu, 26 January 2012 08:54 Go to previous messageGo to next message
HagenFriend
Messages: 90
Registered: April 2010
Member
On 1/26/2012 9:02 AM, Jamie Gardiner wrote:
> The error message is actually Undefined symbols:"_main", referenced
> from: start in crt1.10.6.old: symbol(s) not found. I am still at odds

The C runtime needs to link to a function "main". But you don't hae one
if you use a CPP file.

C++ does make "name mangling" to allow several functions with the same
name differing only in return and parameter types.

Look up the explanation for the
extern "C" { ... }
Syntax construct and apply it to the "main" function.


....or just rename your *.cpp file to *.c
Re: make: *** [main] Error 1 [message #783736 is a reply to message #783700] Thu, 26 January 2012 10:51 Go to previous messageGo to next message
Jamie Gardiner is currently offline Jamie GardinerFriend
Messages: 4
Registered: January 2012
Junior Member
Thanks Hagen, I just have a conflicting types error on line 13 now, but should be able to figure this out. Thanks again.
Re: make: *** [main] Error 1 [message #783782 is a reply to message #783736] Thu, 26 January 2012 12:54 Go to previous messageGo to next message
HagenFriend
Messages: 90
Registered: April 2010
Member
On 1/26/2012 11:51 AM, Jamie Gardiner wrote:
> Thanks Hagen, I just have a conflicting types error on line 13 now, but
> should be able to figure this out. Thanks again.

Another catch: Just naming a _file_ "main" means nothing to the actual
defined symbols. C/C++ is not Java (and even there you need to name
methods as expected by other components).

You _do_ need a function with the name "main" to please the linker. :-)

"main" needs a signature similar to "int main(int argc, char *argv[])"
for the C runtime to link to it.

I'd recommend to only wrap this main as an "entry point routine" in an
'extern "C"' declaration and then call your actual work function from it.




[Sorry for the off-topic post: all of this is C/C++ 101, and has nothing
to do at all with Eclipse or CDT.]
Re: make: *** [main] Error 1 [message #1780981 is a reply to message #783782] Tue, 30 January 2018 21:09 Go to previous messageGo to next message
Michael Murdock is currently offline Michael MurdockFriend
Messages: 18
Registered: May 2014
Location: Pittsburgh, PA
Junior Member
Hmm.

I am getting this problem. Though my intent is to create a shared library. I did have this running on Windows7 though then I was using Eclipse Oxygen SR2 in C++ (GNU Toolchain).
Now I am running on CentOS 5.11 w/ Eclipse Luna (still GNU toolchain). So in my case (this is someone else's library) there is no "main()" per se.

What I am looking for is what is the configurations steps I need to modify in my project properties to build this project??

This library is included as a reference in another project that uses some of it's Classes and member functions.

Could use a clue.


A solution can not be found to a problem
with the same mind that created it.
- Albert Einstein
Re: make: *** [main] Error 1 [message #1780982 is a reply to message #1780981] Tue, 30 January 2018 22:00 Go to previous message
Michael Murdock is currently offline Michael MurdockFriend
Messages: 18
Registered: May 2014
Location: Pittsburgh, PA
Junior Member
The latest is I got my whole project to build now (main & library). Now I only have why two member functions can't be resolved outside the class.
Though that is another problem for another topic.

In fact in my case what solve it was following instructions from a link (3714852) from this website. Thanks for all the help.


A solution can not be found to a problem
with the same mind that created it.
- Albert Einstein
Previous Topic:I can't get user defined PATH VARIABLES to work
Next Topic:SVN Project to C++ project
Goto Forum:
  


Current Time: Mon Feb 19 06:37:38 GMT 2018

Powered by FUDForum. Page generated in 0.01998 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software