After you install the compiler it should be already installed PATH on windows for recognize the command of the compiler.
Now let's open notepad and write our code:
The samples code of hello world:
After you copy the code then Save As file name or type CTRL+S then Save as file type as cpp like picture below:#include <iostream>using namespace std;int main()
{
cout << "Hello, World" << endl;
cin.get();
return 0;
}
Then click Save. Now were ready to compile the program, go to start > then click Run or just type Windows+R then on run dialog type "cmd" without quote, locate your cpp location using "cd 'folder location'" example : "cd Desktop"
now when you inside the file location type
g++ -c "filetype.cpp"change the "filetype.cpp" into your cpp files without quote, example: g++ -c helloworld.cpp
if there's no error object files will appears then type another command:
g++ -o "your executable name" "filetype.o"change the "your executable name" into the executable name that you desired then change the "filetype.o" into the object files that appear after you compile the cpp file, example: g++ -o helloworld helloworld.o
And there you go there must be hello world program appear then open it like you do to the same windows application
Video Tutorial : https://www.youtube.com/watch?v=YYl9C1byc5s
No comments:
Post a Comment