Was not declared in this scop

Source: Internet
Author: User
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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.