NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

compile hello world probs

 
Post new topic   Reply to topic    NetBeans Forums -> C/C++ Users
View previous topic :: View next topic  
Author Message
perlsyntax



Joined: 30 Nov 2009
Posts: 7

PostPosted: Sun Oct 24, 2010 9:31 pm    Post subject: compile hello world probs Reply with quote

here my hello world work find on my gvim editor but not in netbeans

#include <stdio.h>

main()
{
for(;Wink
{
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.





PostPosted: Mon Oct 25, 2010 8:11 am    Post subject: compile hello world probs Reply with quote

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(;Wink
{
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

PostPosted: Fri Mar 02, 2012 5:16 am    Post subject: compile hello world probs Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> C/C++ Users All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo