开发者

Somehow display C++ application using double-click on Ubuntu?

开发者 https://www.devze.com 2023-02-06 04:29 出处:网络
I\'m totally new to Ubuntu and C++. Anyway, I have PHP experience. I just created very simple application...

I'm totally new to Ubuntu and C++. Anyway, I have PHP experience.

I just created very simple application...

#include <iostream>



int main() {

    std::cou开发者_Python百科t << "Hello, world!";


    return false;

}

Then compiled it....

g++ hello-world.cpp -o hello-world

But I can't open it with double-click on it, like I did on Windows 7. Only way to get that text printed is to do command...

./hello-world

Is it possible to open compiled file using simple double-click and then get that text somehow printed?


The program you wrote is a console application. In most Linux GUIs, by default if you open a console program from the GUI, the console output will not be displayed. You can either configure the GUI to open a terminal, or you can manually open a terminal and run it yourself.

When doing development, I highly recommend manually running the program - with using the GUI's automatic terminal window opening mode, the terminal will close as soon as the program terminates; so if the program crashes, the message will be lost. Manually opening a terminal ensures it sticks around after termination, so you can read the program's last messages before terminating.

0

精彩评论

暂无评论...
验证码 换一张
取 消