{"id":186,"date":"2020-12-17T17:17:23","date_gmt":"2020-12-17T17:17:23","guid":{"rendered":"https:\/\/devlog.oakcityit.net\/?p=186"},"modified":"2020-12-17T20:53:51","modified_gmt":"2020-12-17T20:53:51","slug":"fake-it-until-you-make-it","status":"publish","type":"post","link":"https:\/\/devlog.oakcityit.net\/fake-it-until-you-make-it\/","title":{"rendered":"Fake it until you Make it"},"content":{"rendered":"\n
Well that feels like multiple steps back to get in the exact same place, but this is actually progress.<\/p>\n\n\n\n
See what had happened was…<\/p><\/blockquote>\n\n\n\n
Until discovering KDevelop I spent too much time relying on Eclipse once I configured it to just work. And it did and it does. But eventually I’d like to move away from Eclipse to KDevelop. Meanwhile, I was not able to compile using my other default build system of (GNU) Make and a Makefile.<\/p>\n\n\n\n
This is why you “get real” as many developer often suggest. It had been a while since I built to the target device (GameShell) and clearly I added content to the project that didn’t build correctly.<\/p>\n\n\n\n
So the basic\/real issue here is that the build system using Make was broken.<\/p>\n\n\n\n
After trying a lot of other fancier solutions, I decided to whittle down the problem domain to the simplest problem. And also heeding the advice of other developers I did so by ditching the IDE’s altogether, if only temporarily.<\/p>\n\n\n\n
I spent a while trying different things just on the command line in vim and directly using cmake, make, g++, gcc, and g++ yesterday but never quite got to the answer. It was mostly just figuring out what didn’t work. Today I ran across a Stack Overflow post where someone was trying to mix .c and .cpp files in their Makefile. I noticed a curious thing that they were able to use g++ instead of gcc to compile their c source code along with c++. So I added a build object for cJSON.c, the source that gave me these errors and it compiled!<\/p>\n\n\n\n
~\/projects\/sdl2-pre-cjson master~5\n\u276f make \nrm -f .\/.depend\ng++ -w -MM src\/Collision.cpp src\/GameObject.cpp src\/UIText.cpp src\/MusicManager.cpp src\/main.cpp src\/Game.cpp src\/Map.cpp src\/ECS\/ECS.cpp src\/TextureManager.cpp src\/Vector2D.cpp src\/AssetManager.cpp src\/UINineSlice.cpp>>.\/.depend;\ng++ -c -o src\/UIText.o src\/UIText.cpp\ng++ -c -o src\/main.o src\/main.cpp\ng++ -c -o src\/Game.o src\/Game.cpp\ng++ -c -o src\/Map.o src\/Map.cpp\ng++ -c -o src\/UINineSlice.o src\/UINineSlice.cpp\ng++ .\/src\/Collision.o .\/src\/GameObject.o .\/src\/UIText.o .\/src\/MusicManager.o .\/src\/main.o .\/src\/Game.o .\/src\/Map.o .\/src\/ECS\/ECS.o .\/src\/TextureManager.o .\/src\/Vector2D.o .\/src\/AssetManager.o .\/src\/UINineSlice.o -w -lSDL2 -lSDL2_image -lSDL2_mixer -o sdl2-2d-game-engine\n\n~\/projects\/sdl2-pre-cjson master~5* 8s\n\u276f .\/sdl2-2d-game-engine \nzsh: segmentation fault (core dumped) .\/sdl2-2d-game-engine<\/code><\/pre>\n\n\n\n
Errr…well at least it compiled. (This error is actually from a previous commit hash that lacked the new offending code. Turns out the error causing the segfault was actually just needing to run a
make clean<\/code> before running make again.<\/p>\n\n\n\n
Now compilation and running both work from the Makefile!<\/p>\n\n\n\n