one or more re definition in c++?

mc 4,696 Reputation points
2024-07-04T12:20:38.15+00:00

struct IDXGIDevice1 *dxgiDevice (?dxgiDevice@@3PEAUIDXGIDevice1@@EA) already define in game.obj.

this is my code:

IDXGIDevice1* dxgiDevice = NULL;

why?

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,769 questions
0 comments No comments
{count} votes

Accepted answer
  1. RLWA32 45,701 Reputation points
    2024-07-04T12:43:25.5133333+00:00

    This kind of error is often caused by defining a variable in a header file which is then included in multiple translation units (.cpp files).


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.