I have made a simple addition program in C in both OS, Linux (Ubuntu and CentOS) and Windows 7 with the same source code, which is as follows:
#include <stdio.h>
int main(){
int a,s,d;
printf("type the values u want to add and give tab between them\n");
scanf("%d %d",&a,&s);
d=a+s;
printf("addition is %d",d);
return 0;
system("read -p 'Press Enter to EXIT...' var");
}
In Windows it runs when I double-click on addition.exe but in Ubuntu (also in CentOS) when I click on the executable file addition, nothing happens. It does not run or open a terminal. However, it runs when I type ./addition in a terminal.
But I want to run it by double-clicking on it. What should I do?
The properties of that files are in this image:
Also there is no option like "open in terminal" in the open with section of properties.
I also tried creating .desktop file which is as follows:
[Desktop Entry]
Name=addition
Type=Application
Exec=/media/smit/D/smits programs of c/projects by code blocks/02U/addition/bin/Debug/addition
Terminal=true
When I click on addition.desktop then it says an error occur while launching application.
I also tried to open it by copying this desktop file to /usr/share/applications.

.desktopfile. And please also copy-paste the contents of that terminal screenshot.desktopfile, at least in my testsExec=/bin/sh -c '/path/to/your/app'. This will start a shell to execute the program. The shell call should succeed and output what's wrong with the application call. And if the path contains spaces, you can surround it with double quotes inside the single quotes of the-coption. Paths with spaces are generally not helpful while debugging problems like this./home/smit/smitsCPrograms/codeBlocks?