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:

  1. download mingw here (particular build) or from official site choose options
  2. extract example: c:\ (result c:\mingw)
  3. open code::blocks
  4. go settings => compiler.
  5. go “toolchain executables”.
  6. in top field “compiler’s installation directory”, change directory 1 extracted compiler. e.g c:\mingw.
  7. change necessary files under “program files” match files under c:\mingw\bin:

enter image description here

  1. before hit “ok”, go leftmost tab “compiler settings”.
  2. select “compiler flags”.
  3. for simplicity, right click in list somewhere , select “new flag”:

enter image description here

  1. type in following , click "ok", , tic box of flag created:

enter image description here

  1. lastly, need specify debugger path. go "settings" => "debugger", click "defualt" on left hand side , enter new full path of executable:

enter image description here


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

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -