c++14 auto lambda does not name a type in jgrasp

203 views Asked by At

g++ version: 4.9.2

jgrasp version: 2.0.1_04

Settings used in jgrasp: default

code used to test:

#include <iostream>
int main(){
    auto glambda = [](auto x){ return x;};
    std::cout << glambda("Hello generic lambda!\n");
    return 0;
}

result:

  • compiles perfectly when using the cygwin terminal
  • jgrasp throws this error when compiling:

    jGRASP exec: g++ -g -o Test.exe Test.cpp
    |Test.cpp: In function 'int main()':
    |Test.cpp:3:9: error: 'glambda' does not name a type
    |    auto glambda = [](auto x){ return x;};
    |         ^
    |Test.cpp:4:50: error: 'glambda' was not declared in this scope
    |    std::cout << glambda("Hello generic lambda!\n");
    |                                                  ^
    

Nothing seems to be out of place. What am i missing here?

1

There are 1 answers

0
Steve On BEST ANSWER

Sorry for wasting your time. It turns out that I needed to add the "-std=c++14" flag in the 'C/L' section of the compiler environment's settings. I'll be closing this question.