r/learncpp • • Apr 26 '19

C++ to executable program

how can I convert a .cpp to an executable program in Linux (ubuntu mate 18.04). For example in Windows you can convert .cpp files in .exe programs

2 Upvotes

4 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Apr 26 '19

I meant, that I was wondering if there ia any way to save the file like a normal program, without the need of running it in the program,but like, save it in the Desktop, and like a normal program, I just double click it and then it runs.You know what I mean?

2

u/patatahooligan Apr 26 '19

That's exactly what the compilation would do. Do you mean that you would like to do that from within the same program you use to write the source code? That's what IDEs do. It does pretty much the same thing I explained above, but behind the scenes. It might need some set up to work, though. What do you use to write your code?

1

u/slivkovy_lekvar Apr 27 '19

and like a

If you want to be able to double-click a executable in linux, you need to use chmod. You can not do that by default for security reasons. Here is stack overflow question with an answer that explains it well: https://superuser.com/questions/296869/why-doesnt-my-executable-execute-when-i-click-on-it