I have a problem compiling with the IDE "Code::Blocks" after running a program already tested on android with "Cxxdroid - C ++ compile IDE for mobile development" that worked very well. This is what the compiler (mingw) of "Code::Blocks" shows:
-------------- Build: Debug in test (compiler: GNU GCC Compiler)------------>---
mingw32-g++.exe -Wall -fexceptions -g -c >C:\Users\amarn\Desktop\test\main.cpp -o obj\Debug\main.o mingw32-g++.exe -o bin\Debug\test.exe obj\Debug\main.o
C:\Users\amarn\Desktop\test\main.cpp: In function 'int main()': C:\Users\amarn\Desktop\test\main.cpp:18:7: warning: 'auto' changes meaning >in C++11; please remove it [-Wc++0x-compat] for (auto a : digits) ^ C:\Users\amarn\Desktop\test\main.cpp:18:12: error: 'a' does not name a type for (auto a : digits) ^ C:\Users\amarn\Desktop\test\main.cpp:25:1: error: expected ';' before '}' >token } ^ C:\Users\amarn\Desktop\test\main.cpp:25:1: error: expected primary-expression before '}' token C:\Users\amarn\Desktop\test\main.cpp:25:1: error: expected ';' before '}' >token C:\Users\amarn\Desktop\test\main.cpp:25:1: error: expected primary-expression before '}' token C:\Users\amarn\Desktop\test\main.cpp:25:1: error: expected ')' before '}' >token C:\Users\amarn\Desktop\test\main.cpp:25:1: error: expected primary-expression before '}' token Process terminated with status 1 (0 minute(s), 0 second(s)) 7 error(s), 1 warning(s) (0 minute(s), 0 second(s))
And here is the program :
#include <string>
#include <iostream>
#include <fstream>
using namespace std;
const string digits = "0123456789abcdefghijklmnopqrstuvwxyz";
int main()
{
ofstream f;
f.open ("e.txt");
for (auto a : digits)
{
f << a ;
if (a == '1')
return 0;
}
}
I think the problem comes from the compiler, if it's the problem then which compiler should I install?