Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » "Undifined reference to main" Enable to compile a Hello World
"Undifined reference to main" Enable to compile a Hello World [message #1708830] Mon, 21 September 2015 15:10 Go to next message
Guillaume Rousseau is currently offline Guillaume RousseauFriend
Messages: 1
Registered: September 2015
Junior Member

I try to compile this:
#include <stdio.h>

int main(void)
  printf("Hello World\n");
  return 0;

But I keep having 23 errors with at the end '"Undifined reference to main".
I'm using linux mint 17 (ubuntu based).

Can you help me with this ?
Re: "Undifined reference to main" Enable to compile a Hello World [message #1708855 is a reply to message #1708830] Mon, 21 September 2015 22:58 Go to previous message
David VavraFriend
Messages: 803
Registered: October 2012
Senior Member
If what you are showing is actually what you are trying to compile then you have a syntax error and likely no object file is being produced. The linker would be then be unable to find it to produce an executable. Try changing the "}=he" at the end to "}" and see what happens.

If the problem persists, you will have to supply the particulars of your project configuration. Such as: what kind of project it is; if you changed any Eclipse settings; and your build log. I created a new Hello World project and changed the code to be the same as yours. My build process stopped at the first error. Your build went all the way to the link phase. My project configuration is different than yours but I don't know how.

[Updated on: Mon, 21 September 2015 23:05]

Report message to a moderator

Previous Topic:(Solved) Indexer disagrees with compiler
Next Topic:Compiler prefix not set correctly in generated file
Goto Forum:

Current Time: Thu Nov 15 14:59:45 GMT 2018

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

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

Back to the top