This is the simplest case ~ but I often make the mistake (basic is also the reason of this a few of the most likely)
in addition, the Internet was also pointed out the following reasons can cause the prompt error:
2. A dependency error occurred when header files #include each other. For example, the header file forms a circular dependency,
/***file a ****/
#ifndef FILE_A_
#define FILE_A_
#include <file b>
#endif
/****file b ***/
#ifndef FILE_B_
#define FILE_B_
#include <file a>
#endif
If variables, functions, and classes in file A are used in file B, then #ifndef and #define are used in file B, and #include <; file a> Unable to execute #include
so, will cause the macro name repetition, there must be a header file for # # ifndef lost effect. Was not decleared in this scope?The header file was not decleared in this scope
Read More:
- g++ error: ‘printf’ was not declared in this scope
- g++ c++ error: ‘malloc’ was not declared in this scope
- error: ‘memcpy’ was not declared in this scope
- error: ‘atoi’ was not declared in this scope
- Arduino ide 1.6.9 problems encountered error:’TKD2′ was not declared in this scope
- error: `cout’ was not declared in this scope
- error: ‘NULL’ was not declared in this scope
- error: ‘exit’ was not declared in this scope
- c++ error: ‘malloc’ was not declared in this scope
- error: ‘vector‘ was not declared in this scope|
- [Error] ‘sort’ was not declared in this scope
- error: ‘CV_BGR2GRAY’ was not declared in this scope
- Code:: blocks prompt nullptr’s was not declared in this scope
- Error:‘itoa’ was not declared in this scope
- error: ‘stoi’ was not declared in this scope linux (Fixed)
- Code::Blocks 12.11 error: ‘nullptr’ was not declared in this scope&GNU GCC -std=gnu++0x
- “Error: ` cout ‘was not declared in this scope”
- Arduino reports an error when writing a custom library file to solve the problem of not name of type, not declared in this scope
- Analysis of compilation errors of “error conflicting types for function”
- Idea ignores compilation errors and runs in eclipse compilation mode