david reeves
Posts: 11
Joined: Thu Nov 26, 2015 10:58 pm

Netbeans C/C++ Link/Make EXE?

Wed Mar 30, 2016 4:52 pm

Hello All!
I've been using Netbeans for remote RPI C program development for some time now. Everything has been working well, build, debug, library includes, etc. ...EXCEPT for one thing...my build option does not create an EXE on the RPI.

I do a find - sudo find / -name.exe and don't find anything however the .o is there no problem

so I have been using the gcc link from the command line: sudo g++ -o project.exe project.o

I've done lots of searches but can't find the issue. This has to be a simple thing but it has eluded me to date.

Can someone please point me in the right direction?
Thanks!

ghans
Posts: 7881
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Netbeans C/C++ Link/Make EXE?

Wed Mar 30, 2016 4:57 pm

Linux does not use file extensions. Linux executables usually
don't have an extension anyway.


ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

david reeves
Posts: 11
Joined: Thu Nov 26, 2015 10:58 pm

Re: Netbeans C/C++ Link/Make EXE?

Wed Mar 30, 2016 6:40 pm

ghans,
THANK YOU for the reply!

Ok, but I also don't have any without any extension. I do see project.cc, project.o, project.o.d. Are you saying that the executable is not named the same thing as the project?

Do I need to modify the make file for a simple example where 1project = 1source.cc=1exe

Or should I / could I organize multiple programs in a single project where 1project=Xsource.cc=Xexe

Thanks!

larsth
Posts: 54
Joined: Sat Aug 27, 2011 9:51 pm
Contact: Website

Re: Netbeans C/C++ Link/Make EXE?

Wed Mar 30, 2016 7:21 pm

If you want to start you compiled program on a Raspberry Pi, then first copy it to the Pi by using scp.
scp it to a directory on the Pi, which is included in the PATH environment variable.

Code: Select all

~/bin
is a good choice, create it with

Code: Select all

mkdir - p ~/bin
, if it doesn't exists.
You may have to restart your SSH session to the Pi to update the PATH environment variable, ~/.bashrc normally do some magic here, if it discovers that you have a ~/bin directory.
Normally you add directories to the PATH environment variable in fx. ~/.profile

To look at the PATH environment variable, run this command:

Code: Select all

printenv | grep PATH
Directories are seperated by a :.
You should find this directory in th PATH environment variable for user pi:

Code: Select all

/home/pi/bin
Then you will need to set the execute bit, otherwise the kernel is of the opinion that the file is a normal file:
If we call the file abc, and is in the current working directory (./), when you will need to run this command:

Code: Select all

chmod ugo+x ./abc
Next run it with (add arguments, if necessary):

Code: Select all

abc
FYI, I had never used Netbeans for C/C++ development, so I don't how it do things.

david reeves
Posts: 11
Joined: Thu Nov 26, 2015 10:58 pm

Re: Netbeans C/C++ Link/Make EXE?

Wed Mar 30, 2016 8:34 pm

"FYI, I had never used Netbeans for C/C++ development, so I don't how it do things."

Thanks for the reply, but I don't think that what you are describing is my problem. I am able to create the executable on the rpi via the gcc linker "manually" from the command line but NETBEANS (I think) is supposed to create the executable on the rpi from the pc when it creates the object code at build time.

User avatar
topguy
Posts: 6164
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Netbeans C/C++ Link/Make EXE?

Fri Apr 01, 2016 11:05 am

david reeves wrote: but NETBEANS (I think) is supposed to create the executable on the rpi from the pc when it creates the object code at build time.
Does it use a crosscompiler or does the compiling from .cpp to .o files happen on the Rpi itself ?
So it looks like the final linking step is missing from your side ?

NetBeans has a log window for compilation, show us the last lines from the compilation log. (or put the whole thing on pastebin if its large )

papatrexasgre
Posts: 24
Joined: Thu Nov 13, 2014 2:52 pm

Re: Netbeans C/C++ Link/Make EXE?

Wed Dec 28, 2016 11:08 am

Hello all,

I know it's an old post but I thought about posting to help others searching for the "exe" location. When I build the project at my computer I get this at the log.
make[2]: Leaving directory '/root/.netbeans/remote/192.168.15.3/mitsas-pc-Windows-x86_64/C/Users/mitsas/Documents/NetBeansProjects/CppApplication_1'
At my raspberry I need to :
cd /root/.netbeans/remote/192.168.15.3/mitsas-pc-Windows-x86_64/C/Users/mitsas/Documents/NetBeansProjects/CppApplication_1/dist/Debug/GNU-Linux/
After dist it's either Debug or Release, depending on what you selected on netbeans.
Inside there I can find the file cppapplication_1 which I can "execute" by typing ./cppapplication_1

I hope this helps.

Return to “C/C++”