Two copies of the same C/CPP global variable link is no problem, the problem of running crashes

I have recently used GPUImage to do the beauty function. The name of the class has been changed to prevent conflicts, but some global variables have not been noticed and have not been renamed. What we do is the SDK static library, as a result, after I gave the library out, the third party also used GPUImage, to compile the link and did not report a conflict, but the program died when it ran. Later, I followed for a while, and the reasons for the collapse were as follows:

//
// BT.709, which is the standard for HDTV.
const GLfloat kColorConversion709[] = {
    1.164,  1.164, 1.164,
    0.0, -0.213, 2.112,
    1.793, -0.533,   0.0,
};

reference with extern in another file

extern const GLfloat kColorConversion601[];

use this worthwhile place, pinch breakpoint debugging, normal _ preferredConversion assignment is 1, when there is a problem, can not get the value from kColorConversion601 memory, access memory crash:

_preferredConversion = kColorConversion601;

question:

  1. there are two global variables mentioned above in SDK, and there are no compilation link errors. What is the reason for this? can you tell me the specific process of compiling links?
  2. guess that there are two copies of the same variable, and the address is wrong when looking for the variable. What exactly is the process? I would like to know
  3. .
  4. if you adjust the link order of the library, the problem of collapse can be solved, which feels strange

I hope to know what my friends tell me. Although the problem has been found and solved, I would like to know why. -sharp-sharp-sharp problem description

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

Jan.08,2022

0, "change the class name in order to prevent conflicts": you can directly use the GPUImage header file without linking the GPUImage code, so that the resulting binary size will be smaller.
1. There are two copies of global variables. Unless static, is added, you must report duplicate symbol
2, "guess there are two copies of the same variable, and the address was wrong when looking for the variable": there should be two copies of the CPP class, not two copies of the global variable
3, "if you adjust the link order of the library, the problem of collapse can be solved": the compilation rule of CPP, one class has more than one implementation, take the implementation of the first link

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3d80d-2b700.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3d80d-2b700.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?