SFML community forums
Help => General => Topic started by: Cewein on March 15, 2018, 12:34:28 pm
-
Hello, I am develloping a application in cpp in VS2017.
there is no code error but there is compiling error.
I have used this tutorial for installing : https://www.kimsgamedev.com/setup-sfml-project-visual-studio-2017/ (https://www.kimsgamedev.com/setup-sfml-project-visual-studio-2017/)
here a pastebin to the code :
case.h : https://pastebin.com/xCnpSVUR (https://pastebin.com/xCnpSVUR)
main.cpp : https://pastebin.com/VHAG20YG (https://pastebin.com/VHAG20YG)
the error look like this :
1>case.obj : error LNK2005: "int __cdecl posCase(int * *,int,int,int)" (?posCase@@YAHPEAPEAHHHH@Z) already define in case.obj
1>case.obj : error LNK2005: "int __cdecl ramCase(int * *,int)" (?ramCase@@YAHPEAPEAHH@Z) already define in case.obj
1>case.obj : error LNK2005: "int __cdecl numberCase(void)" (?numberCase@@YAHXZ) already define in case.obj
1>Main.obj : error LNK2005: "void __cdecl clickMouse(int * *,int,class sf::RenderWindow &)" (?clickMouse@@YAXPEAPEAHHAEAVRenderWindow@sf@@@Z) already define in Main.obj
may i have include headers in a wrong way ?
thanks in advence, and sorry for languages error or the french in pastebin
- Cewein
-
Functions implemented in header files should be inline, otherwise they end up being defined in every .cpp that include the header, and the linker doesn't like duplicated definitions.
Note that this has absolutely nothing to do with SFML, it's basic C++ knownledge.