How to fix auto keyword error in Dev-C++ Last Updated : 15 Jul, 2020 Comments Improve Suggest changes Like Article Like Report The auto keyword in C++ specifies that the type of the variable that is being declared will be automatically deducted from its initializer. In case of functions, if their return type is auto then that will be evaluated by return type expression at runtime. CPP // C++ program to illustrate the auto // keyword in DevC++ compiler #include <bits/stdc++.h> using namespace std; // Driver Code int main() { // Initialize vector vector<int> v = { 1, 2, 3, 4, 5 }; // Traverse vector using auto for (auto x : v) { // Print elements of vector cout << x << " "; } } Output: 1 2 3 4 5 The same code produces error in Dev-C++: If you want to traverse a vector using an auto keyword (as shown in the above code), then it will show error as: Why does this error occur in Dev-C++: The auto keyword introduces in C++ 11, and it is allowed to the user to leave the type deduction to the compiler itself. But while running a program in Dev-C++ then it will be showing error, because in Dev-C++ inbuilt C++98 compiler so that's by that error occurs. How to fix this error: Below are the steps to solve the error: Open Dev C++ go to ->tools. Click on ->compiler options(1st option). A new window will open and in that window click on -> settings: Go to -> code generation: In language standard column(std) choose ->ISO C++11: Click on OK and After that the code will execute and will give no error. Now the code works fine and prints the expected output. Comment More infoAdvertise with us Next Article How to fix auto keyword error in Dev-C++ T tdhanush777 Follow Improve Article Tags : C++ Programs C++ How To Practice Tags : CPP Similar Reads How to Fix Undefined Reference Error in C++? In C++, the undefined reference error typically occurs during the linking phase of compilation. This error indicates that the compiler knows about a function or variable (it has been declared), but it cannot find the actual implementation (definition) during the linking process. The linker needs to 2 min read How to Detect Memory Leaks in C++? Memory leaks are a common and serious problem in C++ programming. They occur when dynamically allocated memory using operators like new or functions like malloc from the heap is not properly deallocated using delete or free, resulting in slow system resource utilization, degraded performance, and po 4 min read How to Compile C++ Code in macOS ? Compiling a C++ code means translating the program from the human-readable form (high-level language) to something a machine can âunderstandâ (machine language) so that the program can run on a machine. In this article, we will learn how to compile C++ code in macOS. C++ Program Compilation in macOS 2 min read How to Fix Segmentation Fault in C++? A segmentation fault is a specific kind of error caused by accessing memory that does not belong to you. It's a common issue in C++ and other low-level languages, while working with arrays and pointers. In this article, we'll explore common causes of segmentation faults and provide strategies to ide 4 min read How to Resolve a Name Conflict in C++? In C++, naming conflict occurs when two identifiers in the same scope have the same name and the compiler cannot infer which identifier to refer to when it is mentioned in the program. In this article, we will discuss what are name conflicts, what are its causes, and how to resolve the name conflict 4 min read How to Define the Default Constructor in C++? In C++, a constructor that takes no parameters is called a default constructor. A default constructor gets automatically invoked when an object of a class is created without any arguments. It is mainly used to initialize legal initial values to the member variables or perform other setup tasks. In t 2 min read How to Add Message to Assert in C++ In C++, assert is a debugging tool that allows the users to test assumptions in their code. The standard assert macro provided by <cassert> checks the condition and if the condition is evaluated as false, the assert statement terminates the program and prints an error message on the console al 2 min read How to Use typename Keyword in C++? In C++, the "typename" is a keyword that was introduced to declare a type. It is used for specifying that the identifier that follows is a type rather than a static member variable. In this article, we will learn how to use the typename keyword in C++. C++ typename KeywordThe typename keyword is mai 2 min read How to Pause a Program in C++? Pausing programs in C ++ is an important common task with many possible causes like debugging, waiting for user input, and providing short delays between multiple operations. In this article, we will learn how to pause a program in C++. Pause Console in a C++ ProgramWe can use the std::cin::get() me 2 min read How to Use the Volatile Keyword in C++? In C++, the volatile keyword is used to tell the compiler that the value of the variable declared using volatile may change at any time. In this article, we will learn how to use the volatile keyword in C++. Volatile Keyword in C++We can use the volatile keyword for different purposes like declaring 2 min read Like