Enabling `-std=c++14` flag in Code::Blocks

前端 未结 2 704
攒了一身酷
攒了一身酷 2020-12-14 04:05

I have installed Code::Blocks for Windows and want to compile C++14 code like generic lambdas but the binary version of Code::Blocks that I\'ve installed from codeblocks.org

2条回答
  •  北荒
    北荒 (楼主)
    2020-12-14 04:43

    May a humble newbie make one small suggestion? A small modification to test C++14 code, to allow resulting .exe file to be run independently of the IDE it was created in, slightly modified test program follows:

     #include 
     #include 
    
     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;
    
         cout << "press enter to continue..." << endl;
         cin.ignore(10, '\n');
         cin.get();
     }
    

    Thank you all, peace to all fellow coders, especially Igor Tandetnik.

提交回复
热议问题