wizkids157 0 Newbie Poster

Hi, I've just started using Netbeans 6.5.1, and I was wondering if you can run a single C file independently of the other C files in the project. This works for java. For example, you can run test1.java and test2.java independently in the same Java project. But it doesn't seem to work for test1.c and test2.c in the same C project. Is there a way to do this, or do you have to create a new C project for every C file?

For example, things work fine if I only have one C file

Running "c:\cygwin\bin\make.exe -f Makefile CONF=Debug" in C:\Users\ranguo\Documents\NetBeansProjects\C_Programming

/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `/cygdrive/c/Users/ranguo/Documents/NetBeansProjects/C_Programming'
/usr/bin/make -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin-Windows/c_programming.exe
make[2]: Entering directory `/cygdrive/c/Users/ranguo/Documents/NetBeansProjects/C_Programming'
mkdir -p dist/Debug/Cygwin-Windows
gcc-3.exe -o dist/Debug/Cygwin-Windows/c_programming build/Debug/Cygwin-Windows/newmain.o
make[2]: Leaving directory `/cygdrive/c/Users/ranguo/Documents/NetBeansProjects/C_Programming'
make[1]: Leaving directory `/cygdrive/c/Users/ranguo/Documents/NetBeansProjects/C_Programming'

Build successful. Exit value 0.

However, this is what I get when I have two C files
Running "c:\cygwin\bin\make.exe -f Makefile CONF=Debug" in C:\Users\ranguo\Documents\NetBeansProjects\C_Programming

/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `/cygdrive/c/Users/ranguo/Documents/NetBeansProjects/C_Programming'
/usr/bin/make -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin-Windows/c_programming.exe
make[2]: Entering directory `/cygdrive/c/Users/ranguo/Documents/NetBeansProjects/C_Programming'
mkdir -p dist/Debug/Cygwin-Windows
gcc-3.exe -o dist/Debug/Cygwin-Windows/c_programming build/Debug/Cygwin-Windows/newmain.o build/Debug/Cygwin-Windows/hello-1.o
build/Debug/Cygwin-Windows/hello-1.o: In function `main':
/cygdrive/c/Users/ranguo/Documents/NetBeansProjects/C_Programming/hello-1.c:1: multiple definition of `_main'
build/Debug/Cygwin-Windows/newmain.o:/cygdrive/c/Users/ranguo/Documents/NetBeansProjects/C_Programming/newmain.c:17: first defined here
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/Cygwin-Windows/c_programming.exe] Error 1
make[2]: Leaving directory `/cygdrive/c/Users/ranguo/Documents/NetBeansProjects/C_Programming'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/cygdrive/c/Users/ranguo/Documents/NetBeansProjects/C_Programming'
make: *** [.build-impl] Error 2

Build failed. Exit value 2.

I have another question that's unrelated. What does "Clean Project" mean?

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.