0

I try to figure out Eclipse by writting a HelloWorld.c from scratch and hope that you can give me some help concerning the problems I face.

  1. When launching Eclipse, I select the standard workspace.
  2. In the Project Explorer, I create a new C project, called HelloWorld. Settings are "Empty Project" and "MinGW". Next: Debug and Release activated. Finish.
  3. In the Menu toolbar "Window->Preferences", I make sure that under "General->Workspace" the "Text File Encoding" is set to UTF-8 and "New Text File Line Delimiter" to Unix. Apply and OK. Again under "Window->Preferences->C/C++->New C/C++ Project Wizard", under "Toolchains" I select "MinGW GCC". "Make Toolchain(s) preferred", "Apply", and "OK".

Now all the necessary setings for this C project are saved in a settings file in the project folder - if I understand this right.

In the Project Explorer, ther HelloWorld Project contains now a header-folder with three subfolders (C:/MinGW64/lib/gcc/x86_64-w64-mingw32/someversion/include and .../include-fixed, and C:/MinGW64/x86_64-w64-mingw32/include).

I create a new C Source File with explicit name "HelloWorld.c" and I get a nice window with lines to write any desired code and also an outcommented "HelloWorld.c"-title on top.

So I write

 #include <stdio.h>

 main(){
     printf("Hello World!");
 return 0;
 }

and save it. So far, so good. Now, I press "Build All" and get a Warning "return type defaults to 'int' [-Wreturn-type]". When I press "Debug", I get the message "Info:Nothing to build for HelloWorld" but when I press "Run", the Console shows "Hello World!" anyway.

In previous (very same) projects, I already got error messages like "Launch failed. Binary not found." which disappeard after many times pressing "Build All" and "Run". And also the error message "Program file does not exist." although I just wrote and saved the above C Source File code. I could not solve it, deleted the Project, restarted Eclipse and did all again as explained above.

What did I or am I doing wrong?

Lucas
  • 125
  • 8
  • 2
    Your first warning of return type is irrelevant; use correct definition for main: `int main(void)` and it will go away. – user694733 Nov 17 '16 at 11:27
  • Ok, thanks, I did that and wanted to see, if Debugging now works fine. But I got the message "Errors exist in the active configuration of project "HelloWorld". Proceed with launch?". Pressing OK gives some veeery strange windows about perspectives and message "Can't find a source file at...". But before, Eclipse found everything and printed "Hello World!" correctly. What's wrong now? Btw, is there a difference between `int main(void){...` and `void main(){...`? – Lucas Nov 17 '16 at 11:34
  • I don't know enough about Eclipse to help with those error messages. As for your question about main, see http://stackoverflow.com/q/2108192/694733 – user694733 Nov 17 '16 at 11:40
  • The options in the new perspective window are "View Disassembly, Locate File, Edit Source Lookup Path" . – Lucas Nov 17 '16 at 11:40
  • We are not a turoring site. There are enough Eclipse tutorials to be found. – too honest for this site Nov 17 '16 at 12:02
  • It's not about tutoring, it's about troubleshooting – Lucas Nov 17 '16 at 18:55

0 Answers0