-
linking/compiling errors
No matter what I do I always ERROR LNK2005 and the best I've done is narrowed it down to just one "TicTacToe.obj : error LNK2005: "struct tictactoe tic" (?tic@@3Utictactoe@@A) already defined in Test.obj". What are some common mistakes made with this error and what can I do to fix it?
My files in the project are
Test.cpp (The main file)
Include files:
#include <windows.h>
#include <iostream>
#include "TicTacToe.h"
using namespace std;
TicTacToe.h (The file with the class definition)
TicTacToe.cpp (The file with all of the constructors)
#include <iostream.h>
#include <windows.h>
#include "TicTacToe.h"
So what's wrong with my linking? Any help would be greatly appreciated. Um... thx
-
In your .h file, you should have
extern struct tictactoe tic;
In ONE .cpp file, you should have
struct tictactoe tic;
-
thx, that worked. Lol, that was the quickest response i ever got.