digitalmars.D.learn - ImportC "no include path set"
- Elfstone (27/27) Feb 05 2023 I'm trying out ImportC, but I can't get even the "Quick Example"
- =?UTF-8?Q?Ali_=c3=87ehreli?= (5/6) Feb 06 2023 I am not familiar with D in Windows but my first guess would be the -I
- bachmeier (3/6) Feb 06 2023 So if you normally use `-I/foo`, you'd add `-P-I/foo`.
- Elfstone (5/11) Feb 06 2023 Thanks, it worked, but I still get the link error.
- ryuukk_ (6/21) Feb 07 2023 You need to run dmd from the developer command prompt on windows
- Elfstone (2/15) Feb 07 2023 That I tried, and I got link error(s) - see my first post. :(
- ryuukk_ (7/26) Feb 07 2023 Oh my bad, i misread your comment
- Elfstone (6/33) Feb 07 2023 I believe all three versions (2017,2019,2022) of my VS are up to
- bachmeier (4/9) Feb 08 2023 Is this documented? I don't use Windows, so I may be missing
- Elfstone (10/19) Feb 08 2023 I found nothing in the Language Reference. I had to figure out
- bachmeier (6/9) Feb 09 2023 Unlikely, since his text editor [doesn't even compile on
- Guillaume Piolat (4/6) Feb 09 2023 It's the one reason I haven't even tried ImportC. I still wonder
- mw (3/9) Jun 21 How to do this in the dub.json file? and work across DMD/LDC/GDC?
- bachmeier (5/19) Jun 22 I don't normally use Dub for this reason (it takes longer for me
- Lance Bachmeier (4/8) Jun 22 It doesn't seem to be documented, but there is a `cImportPaths`
I'm trying out ImportC, but I can't get even the "Quick Example" running. > dmd -v .\source\foobar.c predefs DigitalMars LittleEndian D_Version2 all Windows Win32 CRuntime_Microsoft CppRuntime_Microsoft D_InlineAsm D_InlineAsm_X86 X86 assert D_PreConditions D_PostConditions D_Invariants D_ModuleInfo D_Exceptions D_TypeInfo D_HardFloat binary C:\D\dmd2\windows\bin\dmd.exe version v2.102.0-dirty config C:\D\dmd2\windows\bin\sc.ini DFLAGS -IC:\D\dmd2\windows\bin\..\..\src\phobos -IC:\D\dmd2\windows\bin\..\..\src\druntime\import include C:\D\dmd2\windows\bin\..\..\src\druntime\import\importc.h C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX64\x86\cl.exe /P /Zc:preprocessor /PD /nologo .\source\foobar.c /FIC:\D\dmd2\windows\bin\..\..\src\druntime\import\importc.h /Fifoobar.i .\source\foobar.c(1): fatal error C1034: stdio.h: no include path set Error: C preprocess command C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX64\x86\cl.exe failed for file .\source\foobar.c, exit status 2 So how am I supposed to set the include path? When ran on VS' Command Prompt it spits a link error instead. foobar.obj : error LNK2019: unresolved external symbol __va_start referenced in function _fwprintf_l foobar.exe : fatal error LNK1120: 1 unresolved externals Error: linker exited with status 1120 What am I missing?
Feb 05 2023
On 2/5/23 22:55, Elfstone wrote:So how am I supposed to set the include path?I am not familiar with D in Windows but my first guess would be the -I compiler switch: dmd -I=/my/c/headers ... Ali
Feb 06 2023
On Monday, 6 February 2023 at 06:55:02 UTC, Elfstone wrote:So how am I supposed to set the include path?https://dlang.org/spec/importc.html#preprocessorThe -Ppreprocessorflag switch passes preprocessorflag to the preprocessor.So if you normally use `-I/foo`, you'd add `-P-I/foo`.
Feb 06 2023
On Monday, 6 February 2023 at 14:35:53 UTC, bachmeier wrote:On Monday, 6 February 2023 at 06:55:02 UTC, Elfstone wrote:Thanks, it worked, but I still get the link error. I wasn't expecting to configure include paths and link the right libc myself. The doc says the simple "dmd hello.c" should create "hello.exe". It must be a bug.So how am I supposed to set the include path?https://dlang.org/spec/importc.html#preprocessorThe -Ppreprocessorflag switch passes preprocessorflag to the preprocessor.So if you normally use `-I/foo`, you'd add `-P-I/foo`.
Feb 06 2023
On Tuesday, 7 February 2023 at 06:25:59 UTC, Elfstone wrote:On Monday, 6 February 2023 at 14:35:53 UTC, bachmeier wrote:You need to run dmd from the developer command prompt on windows I always found this requirement weird From an UX point of view, what would the better experience be? Could DMD ship with the required files? I have 0 knowledge how the whole thing works so..On Monday, 6 February 2023 at 06:55:02 UTC, Elfstone wrote:Thanks, it worked, but I still get the link error. I wasn't expecting to configure include paths and link the right libc myself. The doc says the simple "dmd hello.c" should create "hello.exe". It must be a bug.So how am I supposed to set the include path?https://dlang.org/spec/importc.html#preprocessorThe -Ppreprocessorflag switch passes preprocessorflag to the preprocessor.So if you normally use `-I/foo`, you'd add `-P-I/foo`.
Feb 07 2023
On Tuesday, 7 February 2023 at 13:10:44 UTC, ryuukk_ wrote:On Tuesday, 7 February 2023 at 06:25:59 UTC, Elfstone wrote:That I tried, and I got link error(s) - see my first post. :(On Monday, 6 February 2023 at 14:35:53 UTC, bachmeier wrote:You need to run dmd from the developer command prompt on windows I always found this requirement weird From an UX point of view, what would the better experience be? Could DMD ship with the required files? I have 0 knowledge how the whole thing works so..[...]Thanks, it worked, but I still get the link error. I wasn't expecting to configure include paths and link the right libc myself. The doc says the simple "dmd hello.c" should create "hello.exe". It must be a bug.
Feb 07 2023
On Tuesday, 7 February 2023 at 14:01:00 UTC, Elfstone wrote:On Tuesday, 7 February 2023 at 13:10:44 UTC, ryuukk_ wrote:Oh my bad, i misread your comment Make sure your visual studio install is up to date, maybe you have one component missing? https://learn.microsoft.com/en-us/cpp/build/vscpp-step-0-installation If you installed/updated VS without reboot, maybe a reboot could do the trick?On Tuesday, 7 February 2023 at 06:25:59 UTC, Elfstone wrote:That I tried, and I got link error(s) - see my first post. :(On Monday, 6 February 2023 at 14:35:53 UTC, bachmeier wrote:You need to run dmd from the developer command prompt on windows I always found this requirement weird From an UX point of view, what would the better experience be? Could DMD ship with the required files? I have 0 knowledge how the whole thing works so..[...]Thanks, it worked, but I still get the link error. I wasn't expecting to configure include paths and link the right libc myself. The doc says the simple "dmd hello.c" should create "hello.exe". It must be a bug.
Feb 07 2023
On Wednesday, 8 February 2023 at 04:14:21 UTC, ryuukk_ wrote:On Tuesday, 7 February 2023 at 14:01:00 UTC, Elfstone wrote:I believe all three versions (2017,2019,2022) of my VS are up to date, and I have working C/C++ projects on them. But you encouraged me to give a few more tries, and I found out I had been using ..bin64/dmd.exe. Running ..bin/dmd.exe in VS Command Prompt turned out successful. Thx!On Tuesday, 7 February 2023 at 13:10:44 UTC, ryuukk_ wrote:Oh my bad, i misread your comment Make sure your visual studio install is up to date, maybe you have one component missing? https://learn.microsoft.com/en-us/cpp/build/vscpp-step-0-installation If you installed/updated VS without reboot, maybe a reboot could do the trick?On Tuesday, 7 February 2023 at 06:25:59 UTC, Elfstone wrote:That I tried, and I got link error(s) - see my first post. :(On Monday, 6 February 2023 at 14:35:53 UTC, bachmeier wrote:You need to run dmd from the developer command prompt on windows I always found this requirement weird From an UX point of view, what would the better experience be? Could DMD ship with the required files? I have 0 knowledge how the whole thing works so..[...]Thanks, it worked, but I still get the link error. I wasn't expecting to configure include paths and link the right libc myself. The doc says the simple "dmd hello.c" should create "hello.exe". It must be a bug.
Feb 07 2023
On Wednesday, 8 February 2023 at 06:49:06 UTC, Elfstone wrote:I believe all three versions (2017,2019,2022) of my VS are up to date, and I have working C/C++ projects on them. But you encouraged me to give a few more tries, and I found out I had been using ..bin64/dmd.exe. Running ..bin/dmd.exe in VS Command Prompt turned out successful. Thx!Is this documented? I don't use Windows, so I may be missing something, but this looks like one of those "death by paper cut" things. It has the smell of a rough edge that needs fixing.
Feb 08 2023
On Wednesday, 8 February 2023 at 14:08:47 UTC, bachmeier wrote:On Wednesday, 8 February 2023 at 06:49:06 UTC, Elfstone wrote:I found nothing in the Language Reference. I had to figure out using VS Command Prompt and 32bit dmd on my own. The option "-m32omf" did work, after I downloaded sppn.exe and added it to PATH. For some reason sppn.exe wasn't included in dmc-857.exe that came with DMD installation, but is found in dm857c.zip. Maybe Walter doesn't care about Windows enough, but I thought it'd be a must to add basic tests (say, "dmd hello.c") to run on all the platforms before release.I believe all three versions (2017,2019,2022) of my VS are up to date, and I have working C/C++ projects on them. But you encouraged me to give a few more tries, and I found out I had been using ..bin64/dmd.exe. Running ..bin/dmd.exe in VS Command Prompt turned out successful. Thx!Is this documented? I don't use Windows, so I may be missing something, but this looks like one of those "death by paper cut" things. It has the smell of a rough edge that needs fixing.
Feb 08 2023
On Thursday, 9 February 2023 at 06:07:35 UTC, Elfstone wrote:Maybe Walter doesn't care about Windows enough, but I thought it'd be a must to add basic tests (say, "dmd hello.c") to run on all the platforms before release.Unlikely, since his text editor [doesn't even compile on Linux](https://github.com/DigitalMars/med/issues/8). I filed that two years ago. I assume that means Windows is his main development OS. The problems you're describing might be more of a reflection of shortage of Windows users that contribute.
Feb 09 2023
On Wednesday, 8 February 2023 at 14:08:47 UTC, bachmeier wrote:this looks like one of those "death by paper cut" things. It has the smell of a rough edge that needs fixing.It's the one reason I haven't even tried ImportC. I still wonder why I need to provide those headers while for linking MSVC is kinda autodetected now.
Feb 09 2023
On Monday, 6 February 2023 at 14:35:53 UTC, bachmeier wrote:On Monday, 6 February 2023 at 06:55:02 UTC, Elfstone wrote:How to do this in the dub.json file? and work across DMD/LDC/GDC? Thanks.So how am I supposed to set the include path?https://dlang.org/spec/importc.html#preprocessorThe -Ppreprocessorflag switch passes preprocessorflag to the preprocessor.So if you normally use `-I/foo`, you'd add `-P-I/foo`.
Jun 21
On Friday, 21 June 2024 at 17:40:39 UTC, mw wrote:On Monday, 6 February 2023 at 14:35:53 UTC, bachmeier wrote:I don't normally use Dub for this reason (it takes longer for me to figure out how to create the dub.json than it's worth). I'd expect "dflags" to work, but I haven't tried, and I'm not sure how much of ImportC even works with GDC.On Monday, 6 February 2023 at 06:55:02 UTC, Elfstone wrote:How to do this in the dub.json file? and work across DMD/LDC/GDC? Thanks.So how am I supposed to set the include path?https://dlang.org/spec/importc.html#preprocessorThe -Ppreprocessorflag switch passes preprocessorflag to the preprocessor.So if you normally use `-I/foo`, you'd add `-P-I/foo`.
Jun 22
On Saturday, 22 June 2024 at 10:47:42 UTC, bachmeier wrote:I don't normally use Dub for this reason (it takes longer for me to figure out how to create the dub.json than it's worth). I'd expect "dflags" to work, but I haven't tried, and I'm not sure how much of ImportC even works with GDC.It doesn't seem to be documented, but there is a `cImportPaths` argument, which presumably does what you want: https://github.com/dlang/dub/blob/a8da51eb8a5485956622282f2339ec5a39c8c761/source/dub/recipe/json.d#L233
Jun 22