I managed to set up remote development on RPi with Netbeans 8.0.2 over direct connection to my laptop. my simple program compiled, run and debugged.

#include <iostream>
using namespace std;

int main() {
    cout<<"hello Raspberry Pi";
    int e=8;//to see something in variables view
    return 0;

I was satisfied with the result, but default RPi compiler is quite old (version 4.6.3) and does not support C++ 11, so I upgraded gcc and g++ to 4.8.2 and changed the links in /usr/bin. That solved the problem with -std=c++11 not being recognized.

But then another problem arose: while it the code still compiles and runs normally, it can no more be properly debugged: stepping through the code does not work, the debugger goes to disassembly instead, the breakpoint is ignored and the variables view is empty. May be I need to upgrade anything else? here is output of Netbeans build

Copying project files to /home/netbeans/.netbeans/remote/ at netbeans@
Building project files list...
Checking directory structure...
Checking previously uploaded files...
Checking links...
Uploading changed files:
    Zipping 1 changed files...
    Uploading zip to netbeans@
    Unzipping changed files...
Checking exec permissions...
Uploading changed files finished successfully.

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/home/netbeans/.netbeans/remote/'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/hellorpi
make[2]: Entering directory '/home/netbeans/.netbeans/remote/'
mkdir -p build/Debug/GNU-Linux-x86
rm -f "build/Debug/GNU-Linux-x86/main.o.d"
g++    -c -MMD -MP -MF "build/Debug/GNU-Linux-x86/main.o.d" -o build/Debug/GNU-Linux-x86/main.o main.cpp
mkdir -p dist/Debug/GNU-Linux-x86
g++ -o dist/Debug/GNU-Linux-x86/hellorpi build/Debug/GNU-Linux-x86/main.o 
make[2]: Leaving directory '/home/netbeans/.netbeans/remote/'
make[1]: Leaving directory '/home/netbeans/.netbeans/remote/'

BUILD SUCCESSFUL (total time: 2s)
  • I'm not a netbeans user but WRT "so I upgraded gcc and g++ to 4.8.2" -- why don't you just upgrade to Raspbian jessie? Sooner or later it has to happen. 4.9.2 is the default there. Also, I would look and see if there is a way to configure netbeans to use a specific compiler before rearranging links, but sometimes a hack is the only solution. Of course if the default is 4.9.2 it won't matter... – goldilocks Feb 12 '16 at 15:36
  • upgraded to no effect – Andrey Pro Feb 12 '16 at 16:37
  • That's just updating software in the current distro release -- you are obviously using Raspbian/Debian version 7, aka "wheezy". The current version (as of spring 2015) is version 8, aka "jessie". See here about upgrading to that. You can tell the difference by looking at /etc/issue. – goldilocks Feb 12 '16 at 16:49
  • Ok upgraded the system. g++ got upfraded to 4.9 and gdb to 7.7 . And it didnt help. However I managed to find out something: when i start debug and try to run to the cursor, the netbeans shows message: No source file named /home/netbeans/.netbeans/remote/ – Andrey Pro Feb 17 '16 at 13:51
  • 1
    I created a new project, copied the source code and it worked. – Andrey Pro Feb 17 '16 at 14:39

You should compile a compiler by hand with CFLAGS "-g -ggdb" and compile the GDB itself too, use last versions. I've faced same problem in different circumstances, but IDE restored it's normal debugging abilities after a recompile cycle I've mentioned upstrings. And - when you're replacing something in Debian systems - make SURE that you're using update-alternatives script, not just simple replacement

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.