• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Complete noob!

Android Addict

Android Enthusiast
Hi!
I have recently started studying my C++ book and I can't seem to run the example projects from the book in NetBeans IDE. I'm new to this stuff so please take it easy on me. I had no problems when I used java in NetBeans. Any suggestions would be greatly appreciated!

Thanks in advance! :)
 
Try going to Tools > Plugins. Click the "Install" tab. If you don't see an entry called "C/C++", try searching for it in the "Available Plugins" tab.
 
Try going to Tools > Plugins. Click the "Install" tab. If you don't see an entry called "C/C++", try searching for it in the "Available Plugins" tab.

Just checked. I have C/C++ installed already. It won't let me run the code. Its a very simple code straight out of the book. Is there a certain way you're supposed to set the project up? And what file type do I select to type the code in? Sorry for the dumb questions, I just really want to get a head start before school starts.
 
Is it just the files with the code or is it a Netbeans project?

Its a netbeans project. I added a new file to the source folder in the project and typed the simple "Never fear, C++ I here!" Code and it won't run the file. For the project I selected C/C++ application and for the file I selected C++ source file.
 
Cygwin I know from personal experience can be messy...a real kludge IMO. Basically it's supposed to be a *NIX compatibility layer on top of Windows. I bad experiences of it when trying to build versions of Rockbox in Windows, which is an open source music player software replacement for iPods. It was much easier to do in Linux.

Maybe you could try the Linux version of Netbeans, if the Win version is using Cygwin. Put Linux on a virtual machine or something, or install it alongside Windows dual-boot, or even better ditch Micro$oft Windoze completely. :thumbup:
 
Cygwin I know from personal experience can be messy...a real kludge IMO. Basically it's supposed to be a *NIX compatibility layer on top of Windows. I bad experiences of it when trying to build versions of Rockbox in Windows, which is an open source music player software replacement for iPods. It was much easier to do in Linux.

Maybe you could try the Linux version of Netbeans, if the Win version is using Cygwin. Put Linux on a virtual machine or something, or install it alongside Windows dual-boot, or even better ditch Micro$oft Windoze completely. :thumbup:

I love my windows :) but I just installed Code::Blocks and the file compiles correctly but still doesn't run. It just pops up with a command prompt type thing that says 'Hello World' press any key to exit. :banghead:
 
I love my windows :) but I just installed Code::Blocks and the file compiles correctly but still doesn't run. It just pops up with a command prompt type thing that says 'Hello World' press any key to exit. :banghead:

That sounds like it ran...
 
Sure the "Never fear..." etc. was an actual writeline() statement and not just a comment or something? Hello World type programs usually just print out "Hello World!"..that's the classic one
 
Yup that should print out what it says. I'll try it later, I got Netbeans on my Linux PC, configured for C++ . :)

Ok and if you could let me know how you setup the project and what type of file you put the code in I would appreciate it. I feel as if that's the problem for me but I'm not sure. Thanks!
 
Yup that should print out what it says. I'll try it later, I got Netbeans on my Linux PC, configured for C++ . :)



I just tried it in Xcode on my Macbook I got here at the moment, and it does work and do what it's supposed to. Will try Netbeans later.



Normally I don't do programming, "Hello World!" is about as far as I got myself....with C and C++ LOL ...all those brackets and curly braces makes my brain hurt. I like Fortran 77 myself.. :thumbup:
 
I selected C++ application and code is in .cpp

Yeah I definitely forgot something but I'm not sure what. That's the same thing I did on netbeans and keep getting build unsuccessful. I'm gonna try to adjust my compiler settings in netbeans in the morning, I'll post an update then. Thanks for all the help guys, y'all are awesome! :)
 
Yeah I definitely forgot something but I'm not sure what. That's the same thing I did on netbeans and keep getting build unsuccessful. I'm gonna try to adjust my compiler settings in netbeans in the morning, I'll post an update then. Thanks for all the help guys, y'all are awesome! :)

Is it giving a specific error when attempting to compile?
 
Is it giving a specific error when attempting to compile?

When I try to compile it shows: Cannot run program "C:\Users\Public\Desktop\Cygwin" (in directory "C:\Users\Paul\Documents\NetBeansProjects\CppApplication_1"): CreateProcess error=2, The system cannot find the file specified



COMPILE FILE FAILED (exit value -2, total time: 390ms)
 
OK... I've just tried same cpp program in Netbeans 7.4 on Linux and I'm getting this...

P { margin-bottom: 0cm; } "/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/mike/NetBeansProjects/CppApplication_2'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/cppapplication_2
make[2]: Entering directory `/home/mike/NetBeansProjects/CppApplication_2'
mkdir -p build/Debug/GNU-Linux-x86
rm -f build/Debug/GNU-Linux-x86/main.o.d
cpp -c -g -MMD -MP -MF build/Debug/GNU-Linux-x86/main.o.d -o build/Debug/GNU-Linux-x86/main.o main.cpp
cpp: fatal error: is not a valid option to the preprocessor
compilation terminated.
make[2]: *** [build/Debug/GNU-Linux-x86/main.o] Error 4
make[2]: Leaving directory `/home/mike/NetBeansProjects/CppApplication_2'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/home/mike/NetBeansProjects/CppApplication_2'
make: *** [.build-impl] Error 2




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

@Android Addict, is that the same error you're getting? This is with Netbeans 7.4. Presumably the Windows version of Netbeans is using Cygwin for building with GCC.

However in Kdevelop, which is an IDE for KDE, it builds and works just fine.
 
OK... I've just tried same cpp program in Netbeans 7.4 on Linux and I'm getting this...

P { margin-bottom: 0cm; } "/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/mike/NetBeansProjects/CppApplication_2'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/cppapplication_2
make[2]: Entering directory `/home/mike/NetBeansProjects/CppApplication_2'
mkdir -p build/Debug/GNU-Linux-x86
rm -f build/Debug/GNU-Linux-x86/main.o.d
cpp -c -g -MMD -MP -MF build/Debug/GNU-Linux-x86/main.o.d -o build/Debug/GNU-Linux-x86/main.o main.cpp
cpp: fatal error: is not a valid option to the preprocessor
compilation terminated.
make[2]: *** [build/Debug/GNU-Linux-x86/main.o] Error 4
make[2]: Leaving directory `/home/mike/NetBeansProjects/CppApplication_2'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/home/mike/NetBeansProjects/CppApplication_2'
make: *** [.build-impl] Error 2




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

@Android Addict, is that the same error you're getting? This is with Netbeans 7.4. Presumably the Windows version of Netbeans is using Cygwin for building with GCC.

However in Kdevelop, which is an IDE for KDE, it builds and works just fine.
No, I haven't had that error yet. Could I get Kdevelop on windows 7 64 bit?
 
Back
Top Bottom