*/
header is as such:
/*
#ifndef PIECE_H
#define PIECE_H
#include "SDL.h"
class Piece
{
public:
Piece();
Piece(int, int);
int xpos, ypos;
int xvel, yvel;
int actions;
int xCoor, yCoor;
SDL_Texture* pieceText;
int getXPos();
int getYPos();
int getXVel();
int getYVel();
void move(int, int);
bool render(int, int);
void setPieceText(SDL_Texture*);
};
#endif
*/
the errors it throws are:
Error 1 error LNK2005: "public: __thiscall Piece::Piece(void)" (??0Piece@@QAE@XZ) already defined in Piece.obj C:\Users\Vogel 2\documents\visual studio 2013\Projects\P2\P2\Source1.obj P2
Warning 2 warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library C:\Users\Vogel 2\documents\visual studio 2013\Projects\P2\P2\MSVCRTD.lib(cinitexe.obj) P2
Error 3 error LNK1169: one or more multiply defined symbols found C:\Users\Vogel 2\documents\visual studio 2013\Projects\P2\Debug\P2.exe P2
The non-default construct (Piece(int,int)) is okay. Why the trouble with the one but not the other? Thanks in advance
You are not including the .cpp file anywhere are you? The error message mentions Source1.obj so maybe you should make sure you have not defined the constructor by accident in Source1.cpp.
No .cpp anywhere only .h... Source1.cpp has no Piece constructor or data member, not even #include "Piece.h". If there is anything else I can show you to help me resolve this let me know.
Hmm. It sounds like it's also defined it in another place as well. Make sure you check every file you're including/using to make sure you didn't accidentally define it twice.
Oh how I wish VS would actually tell you where the duplicate defining ARE, but alas it is now time for a game of hunt-the-multiply-defined-symbol.
Found it! Kinda silly but here's what happened: had given the wrong name to a .cpp that contained the constructor Piece(); thought I renamed it but must have made Piece.cpp instead. Had the problem as mentioned above and disabled the code in question. Did a solution wide search for "Piece" found a Piece(); that wasn't disabled. DOH!!! Thanks again