Undefined references when compiling on Windows (RtAudio)

Hello,

I am trying to compile this project with of 0.9.4:


On Linux it works fine (Ubuntu), but on Windows I get some undefined references to RtAudio related libraries.

when I add some libraries and move some others to the end in the linker command, the program works, but what is the trick to add the correct libs to the project (.qbs) file?
I had to move -lole32 -ldsound to the end of the line, and add missing libs -lrtaudio -lksuser.

Any ideas? Do I have to add a plugin?

original:
C:/msys32/mingw32/bin/g++.exe “-Wl,–unresolved-symbols=ignore-in-shared-libs” “-Wl,-subsystem,windows” -LC:/msys32/mingw32/lib -LC:/msys32/mingw32/lib -LC:/msys32/mingw32/lib -o C:/Users/Frans/VideoZuil2/ofVideoZuil/bin/ofVideoZuil.exe C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/106f797317d1d010/ofxBaseGui.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/106f797317d1d010/ofxButton.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/106f797317d1d010/ofxGuiGroup.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/106f797317d1d010/ofxLabel.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/106f797317d1d010/ofxPanel.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/106f797317d1d010/ofxSlider.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/106f797317d1d010/ofxSliderGroup.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/106f797317d1d010/ofxToggle.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/122e59c6e1cfb9b0/ofxCvColorImage.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/122e59c6e1cfb9b0/ofxCvContourFinder.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/122e59c6e1cfb9b0/ofxCvFloatImage.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/122e59c6e1cfb9b0/ofxCvGrayscaleImage.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/122e59c6e1cfb9b0/ofxCvHaarFinder.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/122e59c6e1cfb9b0/ofxCvImage.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/122e59c6e1cfb9b0/ofxCvShortImage.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/f27fede2220bcd32/main.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/f27fede2220bcd32/ofApp.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/f27fede2220bcd32/ofxVideoRecorder.cpp.o C:/Users/Frans/VideoZuil2/of_v0.9.4_msys2_release/libs/openFrameworksCompiled/lib/msys2/libopenFrameworks.a -lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_viz -lopencv_core C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/fmodex/lib/msys2/libfmodex.a C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/fmodex/lib/msys2/libfmodexL.a C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/glfw/lib/msys2/libglfw3.a C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/quicktime/lib/msys2/qtmlClient.dll C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/tess2/lib/msys2/libtess2.a C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/videoInput/lib/msys2/libvideoinput.a C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/poco/lib/msys2/libPocoNetSSL.a C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/poco/lib/msys2/libPocoNet.a C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/poco/lib/msys2/libPocoCrypto.a C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/poco/lib/msys2/libPocoUtil.a C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/poco/lib/msys2/libPocoJSON.a C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/poco/lib/msys2/libPocoXML.a C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/poco/lib/msys2/libPocoFoundation.a -lz -lglew32 -lssl -lcrypto -lopengl32 -lgdi32 -lmsimg32 -lglu32 -ldsound -lwinmm -lstrmiids -luuid -lole32 -loleaut32 -lsetupapi -lwsock32 -lws2_32 -lIphlpapi -lComdlg32 -lfreeimage -lboost_filesystem-mt -lboost_system-mt -lfreetype -lcairo -lpthread
working:
C:/msys32/mingw32/bin/g++.exe “-Wl,–unresolved-symbols=ignore-in-shared-libs” “-Wl,-subsystem,windows” -LC:/msys32/mingw32/lib -LC:/msys32/mingw32/lib -LC:/msys32/mingw32/lib -o C:/Users/Frans/VideoZuil2/ofVideoZuil/bin/ofVideoZuil.exe C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/106f797317d1d010/ofxBaseGui.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/106f797317d1d010/ofxButton.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/106f797317d1d010/ofxGuiGroup.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/106f797317d1d010/ofxLabel.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/106f797317d1d010/ofxPanel.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/106f797317d1d010/ofxSlider.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/106f797317d1d010/ofxSliderGroup.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/106f797317d1d010/ofxToggle.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/122e59c6e1cfb9b0/ofxCvColorImage.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/122e59c6e1cfb9b0/ofxCvContourFinder.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/122e59c6e1cfb9b0/ofxCvFloatImage.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/122e59c6e1cfb9b0/ofxCvGrayscaleImage.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/122e59c6e1cfb9b0/ofxCvHaarFinder.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/122e59c6e1cfb9b0/ofxCvImage.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/122e59c6e1cfb9b0/ofxCvShortImage.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/f27fede2220bcd32/main.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/f27fede2220bcd32/ofApp.cpp.o C:/Users/Frans/VideoZuil2/build-VideoZuil2-openFrameWorks-Release/qtc_openFram_68f4cbef-release/ofVideoZuil.qtc-openFram-68f4cbef.e32e46be/.obj/f27fede2220bcd32/ofxVideoRecorder.cpp.o C:/Users/Frans/VideoZuil2/of_v0.9.4_msys2_release/libs/openFrameworksCompiled/lib/msys2/libopenFrameworks.a -lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_viz -lopencv_core C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/fmodex/lib/msys2/libfmodex.a C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/fmodex/lib/msys2/libfmodexL.a C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/glfw/lib/msys2/libglfw3.a C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/quicktime/lib/msys2/qtmlClient.dll C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/tess2/lib/msys2/libtess2.a C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/videoInput/lib/msys2/libvideoinput.a C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/poco/lib/msys2/libPocoNetSSL.a C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/poco/lib/msys2/libPocoNet.a C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/poco/lib/msys2/libPocoCrypto.a C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/poco/lib/msys2/libPocoUtil.a C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/poco/lib/msys2/libPocoJSON.a C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/poco/lib/msys2/libPocoXML.a C:/Users/Frans/VideoZuil2/ofVideoZuil/…/of_v0.9.4_msys2_release/libs/poco/lib/msys2/libPocoFoundation.a -lz -lglew32 -lssl -lcrypto -lopengl32 -lgdi32 -lmsimg32 -lglu32 -lwinmm -lstrmiids -luuid -loleaut32 -lsetupapi -lwsock32 -lws2_32 -lIphlpapi -lComdlg32 -lfreeimage -lboost_filesystem-mt -lboost_system-mt -lfreetype -lcairo -lpthread -lrtaudio -lksuser -lole32 -ldsound

I’m having a similar problem with of-0.9.4 + Qt creator on OSX, didn’t find a solution 'til now

When you say “I had to move -lole32 -ldsound to the end of the line, and add missing libs -lrtaudio -lksuser”
which lines of your qbs file have you modified ?

I didnt change te qbs file. I copied the linker command from the compile output and pasted into msys2 prompt.

The qbs file was exactly my question

you can change the order in libs/openFrameworksCompiled/project/qtcreator/modules/of/of.js line 151 contains the windows libraries that seem to be the problem. this sounds like a bug, can you send a PR if it works for you changing it there?

Thanks Arturo, I did commit a patch to 0.9.4 here:


I created a branch from tag 0.9.4 and then committed the working of.qbs file with the fixed libs.

loks good, can you send a pull request?

I could send a pull request, but to which branch? There is only a tag 0.9.4. It can’t be applied to Master as the file has changed a lot

oh, i see, i’ve just created a 0.9.5 branch from stable can you send it there?

Here it is:
https://github.com/openframeworks/openFrameworks/pull/5320

Hello,

Thanks for these improvements. But now I’ve got a
cannot find -lrtaudio
message.

OF 0.9.6 + Qt Creator 4.1.0 + Windows 7

I can compile with msys2 but not with Qt Creator. The command line generated by Qt Creator seems to be wrong:

C:/msys64/mingw32/bin/g++.exe
“-Wl,–unresolved-symbols=ignore-in-shared-libs”
“-Wl,-subsystem,windows”

-LC:/msys64/mingw32/lib

-o of_home/addons/ofxFft/example-basic/bin/example-basic.exe

obj_path1/kiss_fft.c.o
obj_path1/kiss_fftr.c.o
obj_path2/ofxEasyFft.cpp.o
obj_path2/ofxFft.cpp.o
obj_path2/ofxFftBasic.cpp.o
obj_path2/ofxFftw.cpp.o
obj_path2/ofxProcessFFT.cpp.o
obj_path3/main.cpp.o
obj_path3/ofApp.cpp.o

of_home/libs/openFrameworksCompiled/lib/msys2/libopenFrameworks.a
of_home/libs/fmodex/lib/msys2/libfmodex.a
of_home/libs/fmodex/lib/msys2/libfmodexL.a
of_home/libs/glfw/lib/msys2/libglfw3.a
of_home/libs/quicktime/lib/msys2/qtmlClient.dll
of_home/libs/tess2/lib/msys2/libtess2.a
of_home/libs/videoInput/lib/msys2/libvideoinput.a
of_home/libs/poco/lib/msys2/libPocoNetSSL.a
of_home/libs/poco/lib/msys2/libPocoNet.a
of_home/libs/poco/lib/msys2/libPocoCrypto.a
of_home/libs/poco/lib/msys2/libPocoUtil.a
of_home/libs/poco/lib/msys2/libPocoJSON.a
of_home/libs/poco/lib/msys2/libPocoXML.a
of_home/libs/poco/lib/msys2/libPocoFoundation.a

-lz
-lglew32
-lopengl32
-lgdi32
-lmsimg32
-lglu32
-lwinmm
-lstrmiids
-luuid
-loleaut32
-lsetupapi
-lwsock32
-lws2_32
-lIphlpapi
-lComdlg32
-lfreeimage
-lboost_filesystem-mt
-lboost_system-mt
-lfreetype
-lcairo
-lpthread
-lrtaudio
-lksuser
-lole32
-ldsound

leads to cannot find -lrtaudio

I don’t know how to fix this, but I can give a clue:

To make this command line works (with the msdos prompt) I had to replace -lrtaudio by of_home/libs/rtAudio/lib/msys2/librtaudio.a, to remove all the libPocoXXX.a stuffs and to replace them by the -lPocoCrypto -lPocoData -lPocoDataSQLite -lPocoFoundation -lPocoJSON -lPocoNet -lPocoNetSSL -lPocoUtil -lPocoXML -lPocoZip which appears in the make command output. Meaning:

C:/msys64/mingw32/bin/g++.exe
“-Wl,–unresolved-symbols=ignore-in-shared-libs”
“-Wl,-subsystem,windows”
-LC:/msys64/mingw32/lib

-o of_home/addons/ofxFft/example-basic/bin/example-basic.exe

obj_path1/kiss_fft.c.o
obj_path1/kiss_fftr.c.o
obj_path2/ofxEasyFft.cpp.o
obj_path2/ofxFft.cpp.o
obj_path2/ofxFftBasic.cpp.o
obj_path2/ofxFftw.cpp.o
obj_path2/ofxProcessFFT.cpp.o
obj_path3/main.cpp.o
obj_path3/ofApp.cpp.o

of_home/libs/openFrameworksCompiled/lib/msys2/libopenFrameworks.a
of_home/libs/fmodex/lib/msys2/libfmodex.a
of_home/libs/fmodex/lib/msys2/libfmodexL.a
of_home/libs/glfw/lib/msys2/libglfw3.a
of_home/libs/quicktime/lib/msys2/qtmlClient.dll
of_home/libs/tess2/lib/msys2/libtess2.a
of_home/libs/videoInput/lib/msys2/libvideoinput.a
of_home/libs/rtAudio/lib/msys2/librtaudio.a

-lz
-lglew32
-lopengl32
-lgdi32
-lmsimg32
-lglu32
-lwinmm
-lstrmiids
-luuid
-loleaut32
-lsetupapi
-lwsock32
-lws2_32
-lIphlpapi
-lComdlg32
-lfreeimage
-lboost_filesystem-mt
-lboost_system-mt
-lfreetype
-lcairo
-lpthread
-lksuser
-lole32
-ldsound
-lPocoCrypto
-lPocoData
-lPocoDataSQLite
-lPocoFoundation
-lPocoJSON
-lPocoNet
-lPocoNetSSL
-lPocoUtil
-lPocoXML
-lPocoZip

Don’t know how to help more. I can open an github issue if this is pertinent.