I've recently started learning c++ via the cplusplus.com tutorials. Though I wanted to try to compile a a simple code the prints out "Hello World"; It worked fine for linux, but I have to open it via the console for it to work, I can't simply double click it even if I set it as "executable". I don't really care, since when was Linux that easy. But then I wanted to make an app for Windows in c++, a simple Hello World Console App. The issue is, if I compile a file, I have to access it through the windows console for it to work, but I don't want that.
1- How can I make the code auto open CMD and run?
2- Do i need to compile the code seperately in Windows? or can I compile it in Linux via G++ compiler?
3- Please explain to me the basic ideas of comiling and how to make a code auto run in the console/terminal.
Sincerely, RonnyM
If I understand your question correctly, I can answer some of your questions. I think I could comment your questions, but I dont know how, so I answer you here.
Sometimes people create batch files to execute a bunch of commands sequentially.
Yes, you have to compile separately. Executable files are PE(Portable Executable) under Windows and are ELF(Executable Linkable Format), so the compiler generate different formats of executable files under different OS. There are also some difference about linking libraries, different system have different libraries so compiler knows which ones to use. Sometimes you can convert different format of executable files, you can google "PE VS ELF", you will got many stuff about these.
Compiling is a process that translate your code to binary files, which can execute on your hardware. And what do you mean auto run? Do you mean how the binary files start to execute?