Using bindbc-sdl with D
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Sun Mar 12 02:24:31 UTC 2023
On 12/03/2023 3:12 PM, idsize wrote:
> I started learning D a few weeks ago and am enjoying it so far. I would
> like to use SDL with D and found bindbc-sdl, but I cannot figure out how
> to make it work.
Welcome!
> From my understanding, I'll need to use 'dub fetch bindbc-sdl' to
> download it, and then run 'dub build bindbc-sdl' to build it, before I
> can use it. Fetching it works, but it always fails to build. I get this
> error: 'failed launching cl.exe /P /Zc:preprocessor /PD /nologo ... '.
You don't need to do that, add it as a dependency in your dub package
and dub will do the rest.
But ugh that error looks weird. That would imply its trying to run the C
preprocessor for ImportC. That does not sound right at all, I don't see
any C headers/code in bindbc-sdl repo (not that it needs it). Gonna need
to see the entire error log for that to know whats going on (and
possibly the verbose output).
> Additionally, a more general question about bindbc, is it possible to
> skip using dub altogether? Like would placing the bindbc files inside of
> 'C:\D\dmd2\src\druntime\import' work directly?
Yes, but not that way. Druntime/phobos are both distributed compiled,
the import directories tell the compiler what has been compiled in and
allow access to templates defined by the library (which you then compile).
If you add the appropriate versions and copy the files to your project
directory (including bindbc-loader) that should work however as long as
you compile it in.
More information about the Digitalmars-d-learn
mailing list