NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
perlsyntax
Joined: 30 Nov 2009 Posts: 7
|
Posted: Sun Oct 24, 2010 9:31 pm Post subject: compile hello world probs |
|
|
here my hello world work find on my gvim editor but not in netbeans
#include <stdio.h>
main()
{
for(;
{
printf ("Hello World!\n");
}
}
Here the error message
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/perlsyntax/NetBeansProjects/CppApplication_1'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/cppapplication_1
make[2]: Entering directory `/home/perlsyntax/NetBeansProjects/CppApplication_1'
mkdir -p dist/Debug/GNU-Linux-x86
gcc -o dist/Debug/GNU-Linux-x86/cppapplication_1 build/Debug/GNU-Linux-x86/hello.o build/Debug/GNU-Linux-x86/main.o
build/Debug/GNU-Linux-x86/main.o: In function `main':
/home/perlsyntax/NetBeansProjects/CppApplication_1/main.c:14: multiple definition of `main'
build/Debug/GNU-Linux-x86/hello.o:/home/perlsyntax/NetBeansProjects/CppApplication_1/hello.c:5: first defined here
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-Linux-x86/cppapplication_1] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
make[2]: Leaving directory `/home/perlsyntax/NetBeansProjects/CppApplication_1'
make[1]: Leaving directory `/home/perlsyntax/NetBeansProjects/CppApplication_1'
BUILD FAILED (exit value 2, total time: 114ms)
any ideas? |
|
| Back to top |
|
 |
Vladimir Voskresensky Posted via mailing list.
|
Posted: Mon Oct 25, 2010 8:11 am Post subject: compile hello world probs |
|
|
I think in gvim you compile file, while in NB you compile project with 2
files (main.c and hello.c) into "cppapplication_1" executable file.
Both your files have "main" function which is the root of the problem.
Thanks,
Vladimir.
On 10/25/2010 01:31 AM, perlsyntax wrote:
| Quote: | here my hello world work find on my gvim editor but not in netbeans
#include<stdio.h>
main()
{
for(;
{
printf ("Hello World!\n");
}
}
Here the error message
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/perlsyntax/NetBeansProjects/CppApplication_1'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/cppapplication_1
make[2]: Entering directory `/home/perlsyntax/NetBeansProjects/CppApplication_1'
mkdir -p dist/Debug/GNU-Linux-x86
gcc -o dist/Debug/GNU-Linux-x86/cppapplication_1 build/Debug/GNU-Linux-x86/hello.o build/Debug/GNU-Linux-x86/main.o
build/Debug/GNU-Linux-x86/main.o: In function `main':
/home/perlsyntax/NetBeansProjects/CppApplication_1/main.c:14: multiple definition of `main'
build/Debug/GNU-Linux-x86/hello.o:/home/perlsyntax/NetBeansProjects/CppApplication_1/hello.c:5: first defined here
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-Linux-x86/cppapplication_1] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
make[2]: Leaving directory `/home/perlsyntax/NetBeansProjects/CppApplication_1'
make[1]: Leaving directory `/home/perlsyntax/NetBeansProjects/CppApplication_1'
BUILD FAILED (exit value 2, total time: 114ms)
any ideas?
|
|
|
| Back to top |
|
 |
wignition
Joined: 02 Mar 2012 Posts: 1
|
Posted: Fri Mar 02, 2012 5:16 am Post subject: compile hello world probs |
|
|
This may be way off...
but it's not abundantly clear to us noobs that the file (like "hello.cpp") has to live inside a project before netbeans will (even begin to) play nicely with it.
We're still working in single-source projects, on pre-installed IDE's in our classrooms, and frankly are still tickled when "hello.cpp" compiles. So, the concept of multi-source, or any other reasoning behind that mysterious projects tree, is entirely foreign. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|