fork download
  1. // microsoft compile with(modify the paths as appropriate):
  2. // cl -EHsc -Fehello.exe -Ox hello.cpp -I"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include" -link -libpath:"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib" -libpath:"G:\Microsoft SDKs\Windows\v7.1\Lib"
  3. // mingw compiled with:
  4. // g++ -s -pedantic -std=c++11 -O3 -static-libgcc -static-libstdc++ -o hello2.exe hello.cpp
  5. // binary size difference: cl == 97kb vs mingw-g++ == 643kb
  6. #include <iostream>
  7. #include <string>
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12. string test_str = "hello works!\n";
  13. cout << test_str;
  14. }
  15.  
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
hello works!