opus
opus copied to clipboard
MinGW Compiling code using Opus using libraries
Hello,
I am looking at using libraries but I have already given a few shots... Let say I want to compile this standalone Opus use file: https://pastebin.com/L5P2cyZS
I have libraries available here? https://archive.mozilla.org/pub/opus/win32/opusfile-v0.9-win32.zip
If I do mingw32-g++ main.cpp -L "folderWhereIUnarchiveThePreviousFile"
I always get:
undefined reference to `opus_get_version_string'
and others... (I tried this several times in the past weeks...)
Any ideas please?
Note that main.cpp
is the code from the pastebin.
I know that g++
don't get the good libraries but I don't know how to solve it...
Am I trying to link not the good libs?
It seems that there isn't any available Windows artifact here: https://github.com/xiph/opus-tools/issues/43
Could we have precise instructions for Windows using MinGW and not Microsoft Visual please? (cf README.md
0) Set up a development environment)
add
-lopus
at the end, that is
mingw32-g++ main.cpp -L "folderWhereIUnarchiveThePreviousFile" -lopus
Hello
When you develop with MinGW, I would recommend using MSYS2 (UNIX-like terminal) and mingw-w64 toolchain. It is the easiest way.
go to https://www.msys2.org/ and follow steps from 1 to 8.
Then, in the MinGW 64 bits terminal, install opus :
pacman -Syu mingw-w64-x86_64-opus
then go to your project directory and :
g++ -Wall -Wextra -o project main.cpp pkg-config --cflags --libs opus
hth
Vincent Torri
On Sun, Oct 31, 2021 at 1:10 AM Benjamin Loison @.***> wrote:
After a year not having added -lopus at the end at that time looked such a common mistake however after working again on my problem when adding -lopus I have "cannot find -lopus" error.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/xiph/opus/issues/173#issuecomment-955606137, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK3IQMJUUKID7ANJB5RHDTUJSCPHANCNFSM4MDKLWBQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Hello
Thank you for your detailed answer. However as I try to repeat I have to be able to compile the pastebin I sent or opus tools on MinGW because I want to use opus in a huge project (my video game) which uses MinGW so using MSYS2 or cross-compiling etc doesn't seem appropriate.
And the nearest approach using MinGW given by opus is about using msbuild 😅
well, i use msys(2) + mingw(-w64) for around 15 years (natively or cross-compilation). The only thing you will need is the DLL of opus and its dependencies, and copy them in the same directory of your binary.
I use msys2 + mingw-w64 to compile a big toolkit (and I create an NSIS installer for it), vlc is also using msys2+mingw-w64, like a lot of other projects.
Here is the list of projects that I compile for the toolkit above (opus is int it) :
https://github.com/vtorri/ewpi/blob/master/README.md