On Saturday, 23 May 2020 at 03:29:44 UTC, Daniel C wrote:
On Saturday, 23 May 2020 at 03:25:12 UTC, Daniel C wrote:
I'm building my app without dub. I've now put all the source files into the same folder as my project and I'm still seeing the same undefined symbol issue.

I should say, I put the bindbc library into a subfolder. So it's like this:

project/bindbc/sdl/bind

The SDL lib files are in the same folder with the source, primarily because the LIB environment variable was being ignored by the compiler/linker.

I suggest you create project/lib and drop the SDL libraries there along with the bindbc-sdl library and pass the path to the linker. Since you should be using the MS linker (see below), it expects the /LIBPATH option (https://docs.microsoft.com/en-us/cpp/build/reference/libpath-additional-libpath?view=vs-2019), which you can add to your dmd commandline as `-L/LIBPATH:lib`. Of course, that's assuming you've got the Microsoft Build Tools installed either independently or as part of a Visual Studio installation. If not, you'll be using the LLVM linker that ships with DMD. I believe in that case it should be `-L-Llib`.

If you really want 32-bit and to statically link with the SDL import libraries, I strongly recommend you use the -m32mscoff dmd options (and the corresponding -ax86_mscoff dub option). The SDL libraries are distributed as COFF, not OMF, so using OPTLINK would require converting the lib files to OMF first.

Reply via email to