So, I’ve been using OF for some time already and there’s this issue when you compile your OF project, it is set to DLL (dynamic linking) by default if i understand correctly? (I currently work with Visual Studio, used Code::Blocks for the first versions of OF).
Tried to do a simple test sketch to confirm the horror I experienced. Is it normal that an OF app won’t load a huge image to be scrolled via ofImage.load(…) ? I’m talking about 10,8 MB png file with dimensions of 12000 x 6200 px. It can’t be a problem, because my desktop computer loads and displays it correctly (Win7 64bit), whereas my notebook (previously Win7 32bit, reinstalled into Win7 64bit) displays errors in the output window of the VS, as soon as such a large image is loaded and nothing is displayed, rather rendering the screen white (yep, pure (255,255,255) of rgb color ).
The funny part is that before I reinstalled my Windows on the notebook, it worked correctly on old win7 32bit version.
This lead me to believe that something like the infamous “DLL hell” is involved. Also tested my compiled imageTestSketch_debug.exe on my nephew’s computer (dual boot Mac with Windows 7), and the app didn’t even open, complaining about some missing DLL… (think it was some msvcp40.dll or something…)
As I have googled for a solution to this problem, I found that static linking is a versatile fix of such issues and even game development makes use of it (even though it may inflate the executable file, no matter…).
Makes some sense, for the sake of compatibility, to ensure no system .DLLs would interfere with the OF version of the libraries, making it running the same on any machine.
My question is: have you any experience with static linking of an OF project?
I want to build some (trying just a simple sketch with only main.cpp, ofApp.cpp and ofApp.h) using the static linking in preferences, but the components of the OF are not built, because the linker complains about the mismatch in the main.obj.
I’ve provided the image how I changed the runtime library in code generation from Multi-threaded Debug DLL (/MDd) to Multi-threaded Debug (/MTd) - according to the tutorials about static linking, this should tell the linker to link it statically.
And when I do the debug, output shows every ofAppRunner, ofImage, ofTesselator, etc. etc. with a mismatch error, each of them in main.obj
the last lines are:
1>openframeworksLib_debug.lib(of3dUtils.obj) : error LNK2038: mismatch detected for ‘RuntimeLibrary’: value ‘MDd_DynamicDebug’ doesn’t match value ‘MTd_StaticDebug’ in main.obj
1>LINK : fatal error LNK1104: cannot open file ‘libboost_filesystem-vc141-mt-sgd-1_64.lib’
1>Done building project “imageTestSketch.vcxproj” – FAILED.
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
Sorry, I am quite an experienced C++ coder, but never understood compiler and linker, and never bothered with the configurations, just set it up as was illustrated in tutorials…
Is there something more to do than just change the runtime library in the project properties as is shown in the image I provided?