Including windows.h

Valentino Giudice valentino.giudice96 at gmail.com
Mon Jun 22 01:33:37 UTC 2026


Hi.

I know this isn't the first thread about this issue, but they are 
from years ago, so I'm writing to see if something has changed.

Attempting to compile, through importC, on Windows, code that 
includes windows.h leads to several linker C5106 warnings and 
LNK2019 errors from link.exe.

As a workaround, I compiled the C file through cl, from the 
Developer Command Prompt for VS, without linking (through the 
`/c` flag) and added the obj as a source file (instead of the C 
file). I'm using Dub to compile and I also had to add lflags for 
certain libraries (gdi32.lib and user32.lib) in my case.

It works now, but doing things this way is not ideal.

Compiling is no longer cross-platform (windows.h is only on 
Windows, of course, but the file contains specific code for other 
systems) and I can't import symbols through `import`, only 
`extern (C)`.

Is there any way to use importC to compile files that include 
windows.h and, if not, are there any plans to resolve this?

Thank you a lot in advance!


More information about the Digitalmars-d mailing list