Look at the code below:
#include <stdio.h>
int a = 1;
int b = 2;
int c = a+b;
int main() {
printf("c is %d\n", c);
return 0;
}
gcc-o test test.c error during compilation: initializer element is not constant
—–
Reason: the value of the global variable C cannot be determined at compile time; it must be determined at run time.
Solutions:
#include <stdio.h>
int a = 1;
int b = 2;
int c;
int main() {
c = a + b;
printf("c is %d\n", c);
return 0;
}
Read More:
- How to Solve Error: “initializer element is not constant”
- How to Solve Error: Element ‘dependency’ cannot have character [children], because the type’s content type is element-
- How to Solve Element Error: target is not existed: .page-component__scroll .el-scrollbar__wrap
- Error: array bound is not an integer constant before ‘]’ token
- How to Fix “Microsoft Visual C ++ 14.0 is required” Error
- How to Fix Error 1069:The service did not start due to a logon failure
- How to Solve Error: Cannot find the declaration of element ‘beans’.
- How to Fix TNS 12560 Error
- (How to Fix) Ora-00600: internal error code, arguments: [4194]
- How to Fix Common Arcpy Error
- How to Fix the common Warning Errors after Vue Project Startup
- How to Fix KeyError: ‘plotly_domain’
- Websocket: How to Fix Error Read Econnreset
- How to Fix IIS7.5 Disallowed Parent Path Error
- How to Fix Error return arrays must be of arraytype
- Start failure: spawn CMD enoent error (How to Fix)
- How to Fix error: conversion from “” to non-scalar type “”
- How to Fix Node SASS Error in Vue + webpack project after nodejs upgrade
- WordPress update failed 429 too many requests (How to Fix)
- How to Fix Microsoft SQL Server Error 1326