Reproduced from: http://blog.csdn.net/zdl1016/article/details/5824443
The answer is: My code is less than a ";"
=====================================
Scene:
Back to the error line, found no problem.
File Error: ptlogin2_api.h (22 lines): expected Unqualified-id before string constant
In the middle of one of my CPP's code (definitely not in header file), I used this file ptlogin2_api.h inside a function of xxx,
#ifdef __cplusplus
extern "C" {================> which line of the error
#endif
It turns out that there was a mistake.
One of the most recent include files that I have included from ptlogin2_api.h
There was a problem #include "dev_db_def.h" ===================. Enumeration value definition last less ";".
#include "Ptlogin_app_id.h"
#include "panel_auth.h"
==========================================
In fact, there are multiple solutions to this problem.
1 Remove the new code, including the header file, to ensure that your code can be compiled through. (In fact, this can be found when their own problems)
2 since the error of the place is not a problem, the code near the problem, or other documents near the problem. Often the case, a file inside the last few ";", in another file error. (It is possible to find problems through this method)
3 VI DEV_INSERT.O to expand the code to see the compiler eventually compiled code, the file state, this method is omnipotent. But also the most complex.
My DEV_INSERT.O unfolds 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 # "Dev_insert.cpp" 2
45066 # 1 "/data/home/nemo/code/isd_qzoneappbase_proj/base_class/base_lib/include/ptlogin_app_id.h" 1
45067 # "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 # -"/data/home/nemo/code/isd_qzoneappbase_proj/outerlib/panel_auth/include/ptlogin2_api.h"
45078 extern "C" {
45079
====================================
Detailed debugging process can refer to a document in the mailbox with GCC search key line error can be.
====================================
GCC common error error, usually because of less; Resolution
Expected Unqualified-id before * * *
Generally, the following message is good semicolon '; ', look up from the error, and see the End class definition of the header file contained above, and the end of the enumeration definition is semicolon-less.
Error:multiple types in one declaration
Generally because, a file inside the definition of two class, where the previous class does not have a number, the last error in the second class.
=====================================
Type redefinition link failed, if the reason for the code is not found, there may be a problem with the makefile file write
This error occurs when you link the same. o file two times. depressed.
GCC under makefile was written by himself, to be very careful.