Linux compilation is normal. Is there an error during arm-linux compilation? (Resolved)
Source: Internet
Author: User
Linux compilation is normal. Is there an error during arm-linux compilation? (Solved) -- Linux general technology-Linux technology and application information. The following is a detailed description. [I = s] This post was last edited by hys97
Ask: I have written a program. In the redhat9.0 environment, the gcc program is compiled and runs properly. But prepare to transplant to arm target board, when using arm-linux-gcc-3.4.1 compilation, program compilation error!
The error code is as follows: (the approximate meaning is to calculate the offset between a member and the first address in the struct)
For (int I = 0; I {
Offset = offsetof (APP_DATA, dataInfo );
// Other processing
}
Compilation error message:
ParaShmOper. cpp: In member function 'int CParaShmOper: putShmPara (int, char *)':
ParaShmOper. cpp: 266: error: 'I' cannot appear in a constant-expression
In addition, I found that offsetof (APP_DATA, dataInfo [0]) is used elsewhere to calculate the offset, but no error is reported.
The brother knows the reason. Please give me some guidance! Thank you!
Solution: Use a static array for initialization. The offsetof parameter is 0, 1, 2 ....
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