(C++) 'assert' was not declared in this scope
February 24, 2017 · View on GitHub
(C++) 'assert' was not declared in this scope


Enviornment
Operating system(s):
Windows XP
Qt Creator 1.3.1
Console application
- G++ 4.4.1
Libraries used:
STL: from GCC,
shipped with Qt Creator 2.0.0
Code
#include <cassert> int main() { assert(1!=2); }
Observations
On Windows, the location of cassert.h was 'C:\qt\2010.02.1\mingw\lib\gcc\mingw32\4.4.0\include\c++\cassert.h'. In cassert.h, assert.h was #included, but this file seems absent.
On Ubuntu, cassert was located at /usr/include/c++/4.4/cassert.h, assert.h at /usr/include/assert.h. I uploaded it to here and copied it to C:\qt\2010.02.1\mingw\lib\gcc\mingw32\4.4.0\include\c++\assert.h', but this fails.
Solution