1

I am pretty new to programming and I am trying to learn C. I installed net beans 8.0.2 on a mac with OS 10.10.3. And I tried to run my first code:

/* HelloWorld.c */
    #include <stdio.h> 
    #include <stdlib.h>
    int main(void) {
    puts("Hello PROGC"); /* prints > Hello PROGC */ 
    return EXIT_SUCCESS;
    }

Now I am getting this Error Message:

"/Library/Developer/CommandLineTools/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
"/Library/Developer/CommandLineTools/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/GNU-MacOSX/cppapplication_1
mkdir -p build/Debug/GNU-MacOSX
rm -f "build/Debug/GNU-MacOSX/Hello World.o.d"
gcc    -c -g -MMD -MP -MF "build/Debug/GNU-MacOSX/Hello World.o.d" -o build/Debug/GNU-MacOSX/Hello\ World.o Hello\ World.c
mkdir -p dist/Debug/GNU-MacOSX
gcc     -o dist/Debug/GNU-MacOSX/cppapplication_1 build/Debug/GNU-MacOSX/Hello\ World.o build/Debug/GNU-MacOSX/main.o 
duplicate symbol _main in:
    build/Debug/GNU-MacOSX/Hello World.o
    build/Debug/GNU-MacOSX/main.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [dist/Debug/GNU-MacOSX/cppapplication_1] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 687ms)

Could you please let me know what I have to change? Many thanks in advance!

ishango
  • 39
  • 8
  • 2
    Looks like you have a `main.c` in the same project. Get rid of it.. – P.P Jun 27 '15 at 22:33
  • I am currently reading the C Programming Language from Brian W.Kernighan and Dennis M. Ritchie. As a C expert would you also be recommending this book? – ishango Jun 28 '15 at 07:27
  • Yes. It's an excellent book. But it's an old and doesn't have modern C. For a complete list, see: http://stackoverflow.com/questions/562303/the-definitive-c-book-guide-and-list – P.P Jun 28 '15 at 07:45
  • @P.P. Thank you for your help! – ishango Jan 07 '17 at 19:47

0 Answers0