I installed NetBeans 8.2 (but the same is for any version of NetBeans C/C++) in a linux OS (Linux Mint Ulyssa, which based to what i know is ubuntu core. I can run successfully with the expected result a project (simple “hello world”) but can’t in the build folder of the project i can’t find a file that i can execute in Linux.
What am i missing, what would the extention of the file be in Linux. Doing the same process in windows i can find the *.exe in the build folder but in linux can’t find a way to create a single runnable file that i can run on any other Linux OS (of course, on the compatible ones).
Advertisement
Answer
So I don’t run netbeans 8.2, but I got a hold of 12.2. And they seem pretty similar.
What I had to do to get the project running was to create the compile (build) command:
g++ main.cpp -o main
And in run I did:
./main
This allowed me to run a hello world code example through netbeans. In case you’re not familiar with g++ the -o argument allows you to set a output-filename.
The code I ran was a simple “hello world”:
#include <stdio.h> int main() { printf("Hello Worldn"); return 0; }
From what I understood in your comments you named the file and output test, so you should change that from my example.
I’m not sure if this solved your problem as the initial description was a bit hard to understand. But this is what I gathered from the information you gave.
To make a desktop runable application from your c-program, you can do the following.
If you want it to be executable from the users account make a <program>.desktop
file and place it in ~/.local/share/applications/<program>.desktop
this will allow the user to execute it witout using a terminal. If you want it to be global then place it inside of /usr/share/applications
This is the desktop-file
[Desktop Entry] Version=1.0 Type=Application Exec=xfce4-terminal -e "/PATH/BINARY" Name=SCRIPTNAME
And this is the updated version of hello world, if you don’t add the scanf then the program just executes without you noticing it.
#include <stdio.h> int main(int argc, char * argv[]) { printf("Hello Worldn"); //Keep the program running until input char ch; scanf("%c", &ch); return 0; }
Hope this helps you out.