I've been trying to get a c++ project to build using this makefile:
The structure of my project is like this:
For context, I'm using a library called Raylib and trying to run on a windows machine. This makefile was provided with a project template and worked just fine before I tried to modify it to run with C++ instead of C and tried to include my source directories for the project instead of including just the main.cpp file.
It compiles just fine, but the linking is where I keep running into issues.
Here's the output when I run the make file:
Executing task in folder VSCode: C:/raylib/w64devkit/bin/mingw32-make.exe RAYLIB_PATH=C:/raylib/raylib PROJECT_NAME=main OBJS=src/main.cpp BUILD_MODE=DEBUG
i686-w64-mingw32-g++ -o main src/main.cpp -Wall -std=c++17 -D_DEFAULT_SOURCE -Wno-missing-braces -g -O0 C:/raylib/raylib/src/raylib.rc.data -Wl,--subsystem,windows -I. -IC:/raylib/raylib/src -IC:/raylib/raylib/src/external -Ilib/ -Ilib/util -Ilib/systems -Ilib/core -Ilib/components -ID://boost_1_81_0 -L. -LC:/raylib/raylib/src -LC:/raylib/raylib/src -lraylib -lopengl32 -lgdi32 -lwinmm -DPLATFORM_DESKTOP
...
C:/raylib/w64devkit/bin/ld.exe: C:\Users\Josh\AppData\Local\Temp\cczAGA5y.o: in function `Z4initv':
D:\Documents\WindowsRaylib\VSCode/src/main.cpp:276: undefined reference to `LocationManager::moveToLocation(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long long, unsigned long long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, MapLocation&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, MapLocation, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >
>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, MapLocation> > >&, entt::basic_registry<entt::entity, std::allocator<entt::entity> >&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >&)'
... (and a bunch more of messages like these)....
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:408: main] Error 1
I've been looking through many posts trying to figure out how to include the right subdirectories in the linking process, but nothing seems to work. I would really appreciate some help!
(one odd thing I noticed is that the object file mentioned in the error "C:\Users\Josh\AppData\Local\Temp\cczAGA5y.o" is in the AppData folder, not my actual project folder. I can't figure out why, though.)