{"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

\"\"<\/figure>\n\n\n\n

Now onward to actually making a game and such…<\/p>\n\n\n\n

Et voil\u00e0, it\u2019s running on device again!<\/p>\n\n\n\n

\"\"<\/figure>\n","protected":false},"excerpt":{"rendered":"

Well that feels like multiple steps back to get in the exact same place, but this is actually progress. See what had happened was… 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… Read More »Fake it until you Make it<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":187,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","_ti_tpc_template_sync":false,"_ti_tpc_template_id":""},"categories":[17],"tags":[19,27,11,28,13,23,10,20,29],"_links":{"self":[{"href":"https:\/\/devlog.oakcityit.net\/wp-json\/wp\/v2\/posts\/186"}],"collection":[{"href":"https:\/\/devlog.oakcityit.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devlog.oakcityit.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devlog.oakcityit.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/devlog.oakcityit.net\/wp-json\/wp\/v2\/comments?post=186"}],"version-history":[{"count":0,"href":"https:\/\/devlog.oakcityit.net\/wp-json\/wp\/v2\/posts\/186\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devlog.oakcityit.net\/wp-json\/wp\/v2\/media\/187"}],"wp:attachment":[{"href":"https:\/\/devlog.oakcityit.net\/wp-json\/wp\/v2\/media?parent=186"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devlog.oakcityit.net\/wp-json\/wp\/v2\/categories?post=186"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devlog.oakcityit.net\/wp-json\/wp\/v2\/tags?post=186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}