'Undefined reference to global variable and relocation truncated to fit R_X86_64_PC32 against symbol
What can this error be due to and how can I fix it?
Undefined reference to 'flag'
relocation truncated to fit R_X86_64_PC32 against symbol 'flag'
header.h
extern bool flag; //declaration
extern int shm[100]; //declaration
static inline function() {
if (flag) {
shm[0] = 10;
}
}
source.c
#include "header.h"
bool flag; //definition
int shm[100]; //definition
flag = true;
function();
printf("value: %d", shm[0]);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
