Raff1
June 5th, 2009, 10:32 AM
Hello!
I am new to Ubuntu and trying to figure out how I can compile .cpp-files and run stuff with g++.
I made a simple hello.cpp which cout's "Hello World!". I then compiled it using the terminal
#include <iostream>
int main(){
std::cout << "Hello World!";
std::cin.get();
}(I later added the cin.get() in order to pause the program in case it would close before I could see the message, but it did not help...)
g++ hello.cpp (or: g++ hello.cpp -o something)After compiling I find some "a.out" or "something" file, but I dont know what kind of files that is or how I can run them. I have tried double clicking on them and running them from the terminal. Whatever I do, I never spot the intended "Hello World!" message.
So what kind of files do I produce when compiling and how do I use them? How can I see the output? Once I am past this initial barrier I can start playing about with the code it self. :p
Thanks in advance,
Regards Raff1
I am new to Ubuntu and trying to figure out how I can compile .cpp-files and run stuff with g++.
I made a simple hello.cpp which cout's "Hello World!". I then compiled it using the terminal
#include <iostream>
int main(){
std::cout << "Hello World!";
std::cin.get();
}(I later added the cin.get() in order to pause the program in case it would close before I could see the message, but it did not help...)
g++ hello.cpp (or: g++ hello.cpp -o something)After compiling I find some "a.out" or "something" file, but I dont know what kind of files that is or how I can run them. I have tried double clicking on them and running them from the terminal. Whatever I do, I never spot the intended "Hello World!" message.
So what kind of files do I produce when compiling and how do I use them? How can I see the output? Once I am past this initial barrier I can start playing about with the code it self. :p
Thanks in advance,
Regards Raff1