error:expected declaration specifiers or ' ... ' before xxx (XXX is a function parameter)

Source: Internet
Author: User

Today, I'm embarrassed by a big

In the morning, when compiling my source code is not through compiling, last Saturday also appeared this situation, at that time did not know how to make the later through the compilation, may be the original. o file without making clean is still there so that it's gone, and my code has been submitted with SVN, It's deadly (polluting the project's source code). Fortunately, I solved it immediately.

Compile error prompt:

........................

error:expected declaration specifiers or ' ... ' before ' Web_voice_var '

Scenario Description:

struct variable web_voice_var var is defined in A.C, A.h declares extern web_voice_var var. i'm B.C I want to use the value of a member of a VAR struct that has already been assigned in A.C, and then include in B.h ". /.. /a.h ", however, there was a compilation error above.

Cause Analysis:

Online search, the discussion of a lot, the more look more dazed.

Maybe the reason is

B.h # include ". /.. /a.h "while a struct or typedef in a b.h is used in a function declaration in a.h, it appears that the struct or typedef in B.H when it contains the A.H is not declared and thus caught in error.

Workaround:

will include ".. /.. /a.h "directly into the B.C, and when made again, pass

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.