Classic troubleshooting process expected unqualified-ID before String constant

Source: Internet
Author: User

The answer is: MyCodeA ";" Missing
============================================
Site:

Return to the row that reported the error and find that there is no problem.

Error file: ptlogin2_api.h (Row 22): Expected unqualified-ID before String constant

In the middle of one of my CPP Code (definitely not in the header file), I used a function XXX in the ptlogin2_api.h file,

# Ifdef _ cplusplus
Extern "C" {=> which row of the error is reported?
# Endif

What is the result of an error?

One of my most recent include files in ptlogin2_api.h
# Include "dev_db_def.h" ============================ "there is a problem! ";" Is missing at the end of the enumeration value definition.
# Include "ptlogin_app_id.h"
# Include "panel_auth.h"

========================================================== =
In fact, there are multiple solutions to find this problem
1) Remove all newly added code, including header files, to ensure that your code can be compiled. (In this way, you can find your own problems)
2) since the error is correct, there is a problem near the code or a problem with other files nearby. This often happens when ";" is missing at the end of a file and an error is reported in another file. (This method may cause problems)
3) VI dev_insert.o expands the code to view the File status when the compiler finally compiles the Code. This method is omnipotent. But it is also the most complex.

Expand my dev_insert.o as follows:

45053 #42 "../comm/dev_db_def.h"
45054 Enum _ errorcodeforeground
45055 {
45056 dr_err_ OK = 0,
45057 dr_err_params_validity = 1000,
45058 dr_err_login_state,
45059 dr_err_insert_dev,
45060 dr_err_select_dev,
45061 dr_err_update_dev,
45062 dr_err_action_type,
45063
45064}
45065 #15 "dev_insert.cpp" 2
45066 #1 "/data/home/Nemo/code/isd_qzoneappbase_proj/base_class/base_lib/include/ptlogin_app_id.h" 1
45067 #16 "dev_insert.cpp" 2
45068 #1 "/data/home/Nemo/code/isd_qzoneappbase_proj/outerlib/panel_auth/include/panel_auth.h" 1
45069
45070
45071
45072 #1 "/data/home/Nemo/code/isd_qzoneappbase_proj/base_class/extern_libs/tdev/include/toiw_all.h" 1
45073 #5 "/data/home/Nemo/code/isd_qzoneappbase_proj/outerlib/panel_auth/include/panel_auth.h" 2
45074 #1 "/data/home/Nemo/code/isd_qzoneappbase_proj/base_class/extern_libs/tbase/include/tbase_all.h" 1
45075 #6 "/data/home/Nemo/code/isd_qzoneappbase_proj/outerlib/panel_auth/include/panel_auth.h" 2
45076 #1 "/data/home/Nemo/code/isd_qzoneappbase_proj/outerlib/panel_auth/include/ptlogin2_api.h" 1
45077 #25"/Data/home/Nemo/code/isd_qzoneappbase_proj/outerlib/panel_auth/include/ptlogin2_api.h"
45078 extern "C "{
45079

==========================================
For detailed troubleshooting, refer to a document in the mailbox to search for the keyword "GCC.

==========================================
Common Errors of GCC, usually because the number is missing

Expected unqualified-ID before ****
Generally, the following message indicates that the semicolon ';' is correct. Locate the error and check whether the semicolon is missing at the end of the class definition and enumeration definition of the header file.

Error: multiple types in one declaration
Generally, because two classes are defined in a file, and the previous class does not have a; number, an error is reported at the end of the second class.

============================================
Type redefinition link failed. If the Code cannot be found, it may be caused by a problem in the MAKEFILE file.
This error occurs when the same. o file is linked twice.

Make sure that the makefile is written by yourself in GCC.

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.