openframeworks / openFrameworks

openFrameworks is a community-developed cross platform toolkit for creative coding in C++.
http://openframeworks.cc
Other
9.97k stars 2.55k forks source link

Building oF Projects with QBS: undefined reference to `__imp_*` #7248

Open aidan-nixon opened 1 year ago

aidan-nixon commented 1 year ago

I'm using the latest master branch of oF. I am attempting to use QBS with MINGW64 to build an empty project - the code was generated by projectGenerator. I had an issue a little while ago when trying to make a project with ofOpenALSoundPlayer, which was fixed by using one of the nightly builds. However, a more complex issue has now presented itself, where the MINGW64 linker seems to place __imp_* infront of most function references. For example, the QBS output is littered with C:/openFrameworks/libs/openFrameworks/sound/ofOpenALSoundPlayer.cpp:39: undefined reference to __imp_alcProcessContext' , where the linker flags look like: C:/msys64/mingw64/bin/g++.exe -Wl,-m,i386pep,-LC:/msys64/mingw64/lib,-LC:\msys64\/mingw32/lib -m64 -o C:/openFrameworks/apps/myApps/spaceRace/bin/spaceRace_debug c:/openFrameworks/apps/myApps/spaceRace/build/gcc_debug/debug/spaceRace.92ca53ff/f27fede2220bcd32/main.cpp.o c:/openFrameworks/apps/myApps/spaceRace/build/gcc_debug/debug/spaceRace.92ca53ff/f27fede2220bcd32/ofApp.cpp.o C:/openFrameworks/libs/openFrameworksCompiled/lib/msys2/libopenFrameworksDebug.a C:/openFrameworks/apps/myApps/spaceRace/../../../libs/kiss/lib/msys2/libkiss.a C:/openFrameworks/apps/myApps/spaceRace/../../../libs/tess2/lib/msys2/libtess2.a C:/openFrameworks/apps/myApps/spaceRace/../../../libs/videoInput/lib/msys2/libvideoinput.a -lcairo -lz -lglew32 -lglfw3 -lcurl -lssl -lcrypto -lrtaudio -lopengl32 -lgdi32 -lmsimg32 -lglu32 -lwinmm -lstrmiids -luuid -loleaut32 -lsetupapi -lwsock32 -lws2_32 -lIphlpapi -lComdlg32 -lfreeimage -lboost_filesystem-mt -lboost_system-mt -lfreetype -lpthread -lksuser -lole32 -ldsound.

As this is one of the first times I've tried to use oF, I am not too certain if anything is particularly concerning with this. Any pointers would be greatly appreciated :)

ofTheo commented 1 year ago

@aidan-nixon if you build an example ( like one of the examples/sound/soundPlayerExample ) with make Release in a mingw64 shell does it build fine?

Just trying to determine if this is a QBS or make issue.

If it works with make you could also try VS Code - you would just need to configure it to use the mingw shell instead of the default shell.

https://forum.openframeworks.cc/t/trying-to-setup-vscode-it-wont-compile/40894/2

ofTheo commented 1 year ago

also tagging @oxillo

aidan-nixon commented 1 year ago

Cheers @ofTheo! Make worked just fine, which is why it was a bit of a head scratcher. I've managed to build all the examples using make, so I'll continue using the Mingw64 shell inside of VS Code for the time being. I only really tried QBS to see if its build graphing would make builds any quicker on my old laptop.

Strangely enough, QBS gave the exact same errors on my PC as my laptop, both with fresh installs (nightly build of oF, latest version of QBS from choco). I'm sure I can figure it out, but I'm not 100% sure that QBS would even provide what I was looking for 😅

dimitre commented 11 months ago

Hello @aidan-nixon in the latest nightlies you can use projectGenerator to build a VSCode (Codium) OF project