Compiling C++ on Linux

Checking GLIBC version on Linux system

$ ldd --version
ldd (Ubuntu GLIBC 2.27-3ubuntu1) 2.27

Hello World

hello.cpp

#include <iostream>

int main() {
    std::cout << "Hello World\n";
}
$ g++ -o hello hello.cpp && ./hello
Hello World

Hello World with namespace

#include <iostream>

using namespace std;

int main(void) {
    cout << "Hello World\n";
    return 0;
}
$ g++ -o hello hello_namespace.cpp && ./hello
Hello World
comments powered by Disqus