Writing a very simple Program Prompt: "was not declared in this scope ". Then search for answers online. In the following situations, this error occurs.
1. variables, functions, or classes are not declared or defined. This is the simplest case.
2. Dependency errors occur when header files are # include each other. For example, header files form a circular dependency,
/***** File ****/
# Ifndef file_a _
# Define file_a _
# Include <file B>
# Endif
/***** File B ***/
# Ifndef file_ B _
# Define file_ B _
# Include <file a>
# Endif
If the variables, functions, and classes in file a are used in file B, the # include <file a> statement in file B will be ineffective due to the role of # ifndef and # define.
3. What I encountered: When I named the header file, I tried to rename the header file in a library, and used this header file in the program. In this way, the # ifndef XXXX and # ifndef XXXX macros have the same name, and the header file I wrote will lose the effect. Other files cannot find the declaration in this header file, and was not decleared in this scope will be prompted.
Build in ubuntu10.04 today
Oms1.5 reported this error:
Frameworks/base/tools/aidl/ast. cpp: 10: Error: 'fprintf' was not declared in this scope
Later, we found that the GCC g ++ of the local machine is version 4.4, installed version 4.3, and re-linked to solve the problem.
Apt-Get install gcc-4.3 g ++-4.3
Enter/usr/bin
CD/usr/bin
Create a soft connection
Ln-s gcc-4.3 gcc
Ln-s g ++-4.3g ++
Then go to the android directory and execute make.