[SOLVED] Coder Error

When trying to debug Classy Clash, I get the following error:

 *  Executing task in folder Section 4 - Classy Clash: C:/raylib/w64devkit/bin/mingw32-make.exe RAYLIB_PATH=C:/raylib/raylib PROJECT_NAME=Character OBJS=*.cpp BUILD_MODE=DEBUG 

mingw32-make Character
make[1]: Entering directory 'F:/vscode/projects/CPP/GameDevTV/C++ Fundamentals/Section 4 - Classy Clash'
g++ -o Character *.cpp -Wall -std=c++14 -D_DEFAULT_SOURCE -Wno-missing-braces -g -O0 C:/raylib/raylib/src/raylib.rc.data -I. -IC:/raylib/raylib/src -IC:/raylib/raylib/src/external -L. -LC:/raylib/raylib/src -LC:/raylib/raylib/src -lraylib -lopengl32 -lgdi32 -lwinmm -DPLATFORM_DESKTOP
C:/raylib/w64devkit/bin/ld.exe: F:\Temp\ccBc46fZ.o: in function `ZN9Character12undoMovementEv':
F:\vscode\projects\CPP\GameDevTV\C++ Fundamentals\Section 4 - Classy Clash/Character.h:32: multiple definition of `Character::undoMovement()'; F:\Temp\ccEcEhCf.o:F:\vscode\projects\CPP\GameDevTV\C++ Fundamentals\Section 4 - Classy Clash/Character.h:32: first defined here
collect2.exe: error: ld returned 1 exit status
make[1]: *** [Makefile:392: Character] Error 1
make[1]: Leaving directory 'F:/vscode/projects/CPP/GameDevTV/C++ Fundamentals/Section 4 - Classy Clash'
make: *** [Makefile:388: all] Error 2

 *  The terminal process "C:\raylib\w64devkit\bin\mingw32-make.exe 'RAYLIB_PATH=C:/raylib/raylib', 'PROJECT_NAME=Character', 'OBJS=*.cpp', 'BUILD_MODE=DEBUG'" terminated with exit code: 2. 
 *  Terminal will be reused by tasks, press any key to close it. 

I think it might be an issue with the compiler.

There’s two potential causes of this error.

  1. You have the function mentioned (undoMovement) declared twice

  2. You have the header for character included in more than one other header, without using “#pragma once” or the define macro mentioned in the course.

Did I really screw up again? My brain must be fried…
main.cpp
Character.h
Character.cpp

Alright, I found what I did wrong. The guy doing these lectures, and the challenges, has been confusing me lately.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms