c++ - Enabling `-std=c++14` flag in Code::Blocks -
i have installed code::blocks windows , want compile c++14 code generic lambdas binary version of code::blocks i've installed codeblocks.org doesn't support flag -std=c++14
.
how update compiler , enable -std=c++14
flag code::blocks?
to compile source code using c++14 in code::blocks, first of need download , install compiler supports c++14 features.
here’s how can on windows:
- download mingw here (particular build) or from official site choose options
- extract example: c:\ (result c:\mingw)
- open code::blocks
- go settings => compiler.
- go “toolchain executables”.
- in top field “compiler’s installation directory”, change directory 1 extracted compiler. e.g c:\mingw.
- change necessary files under “program files” match files under c:\mingw\bin:
- before hit “ok”, go leftmost tab “compiler settings”.
- select “compiler flags”.
- for simplicity, right click in list somewhere , select “new flag”:
- type in following , click "ok", , tic box of flag created:
- lastly, need specify debugger path. go "settings" => "debugger", click "defualt" on left hand side , enter new full path of executable:
now, try compile program c++14 features:
#include <iostream> #include <string> using namespace std; auto main() -> int { auto add_two([](auto x, auto y){ return x + y; }); cout << add_two("i"s, "t"s) << " works!" << endl; }
Comments
Post a Comment