Monday

Getting Started with C++ 2014

Steps are as follows:

Download gcc v5.1.0 32-bit from
ftp://ftp.equation.com/gcc/gcc-5.1.0-32.exe
Install gcc v5.1.0 32-bit to "C:\gcc-5.1.0-32"

Download and install Notepad++ from
https://notepad-plus-plus.org/download/

The Path environment variable to run C++ 2014 on Windows 7 is configured automatically.
If not, open the Environment Variables frame through "Control Panel\System and Security\System".
Hit the end key to scroll to the end of the variable value textbox of variable name Path.
Then, type a semicolon at the end of the existing path, followed by the gcc executable binary directory, which is as follows:
;C:\gcc-5.1.0-32\bin;C:\gcc-5.1.0-32\libexec\gcc\i686-pc-mingw32\5.1.0

Restart your computer because of the installation of gcc v5.1.0 32-bit.

Open Notepad++
Save the new file as "cpp2014_no1.cpp"

File name: cpp2014_no1.cpp
File content:
/**********/
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
    //binary literal
    auto binary_literal = 0b0001'1111;
    cout << binary_literal << endl;
   
    //digit separators
    auto integer_literal = 1'000'000;
    cout << integer_literal << endl;
   
    //generic lambda function
    auto lambda = [](auto x, auto y) {return x + y;};
    auto sum = lambda(1.2, 3.4);
    cout << sum << endl;
   
    return 0;
}
/**********/

Output:
C:\my_folder_path>g++ -std=c++14 cpp2014_no1.cpp -o a.exe

C:\my_folder_path>a
31
1000000
4.6

Step to uninstall GCC downloaded from 
http://www.equation.com/servlet/equation.cmd?fa=fortran
- Open the system path of Environment Variables frame
- Delete the system variable name EQ_LIBRARY_PATH which contains the following variable value
c:\gcc-5.1.0-32\i686-pc-mingw32\lib;
- Edit to delete only the following two system paths from the variable name Path:
--- c:\gcc-5.1.0-32\bin;
--- c:\gcc-5.1.0-32\libexec\gcc\i686-pc-mingw32\5.1.0;
- Delete the folder at C:\gcc-5.1.0-32

No comments:

Measure execution time with Julia, example using sorting algorithms

# random integers between 1 and 100 inclusive, generate thousands of them x = rand ( 1 : 100 , 100000 ) @time sort (x; alg=InsertionSort, r...