[Solved] Fatal error LNK1169: one or more multiple defined symbols were found

Declare the global variable. The global function must be declared in CPP. If other classes refer to the global variable, include the H file of the CPP, and then extern. Otherwise, the repeated definition error is likely to occur.

How does this “easy” explain?

For example, if a global variable is declared in A.H

int Global;

In B.H

include "A.h"
.....
extern int Global;
......

If you include A.H, it is equivalent to including the declaration of global variables in A.H, and the compiler will consider it a duplicate definition.

Therefore, global variables and function declarations must be in CPP when The vs compiler reports this error when there is a function implementation in the H file.

Solution:
1 Yes Add inline
2 before the function declaration in H In project – > Attribute – > Linker – > Command line – > Add/force to additional options

The above is loaded from David_H

I also encountered this error, but the whole project contains too many files to analyze the inclusion relationship, but the problem should be similar.

my solution is:

Project – > Properties – > Linker – > Command line – > Add /force 

to additional options

It solved the error, but there were a lot of warnings.

Read More: