QT multiple definitions of the problem

QT version: Qt 5.5.1 (MSVC 2013, 32 bit)
Qt Creator Version: Qt Creator 3.5.1 (opensource)
system: win10
these days debugger there is a problem it took me a long time to solve the problem described as follows:
colleague gave me a good .a static library file, and gave me complete headers, the results of the first document which has global variables, resulting in my compile time error has been reported multiple definitions.
In theory, I just add in the header file inside

#ifndef HEAD_A
#define HEAD_A
//···coding···
#endif

It should not be a problem multiple definitions.
But the reality is not the case, I made the following tests:
Here Insert Picture Description

Thus, the header files can only make changes to the static library, the ultimate solution is the first document written in a global variable to call a static library cpp file inside that class, there is no question of the multiple definitions.

Guess you like

Origin blog.csdn.net/weixin_43935474/article/details/90711289