LINK : fatal error LNK1104: cannot open file '_CMDLINE' --- errorlevel 1104

Jason Jeffory via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 11 17:44:17 PST 2016


On Tuesday, 12 January 2016 at 01:26:06 UTC, Mike Parker wrote:
> On Monday, 11 January 2016 at 20:19:50 UTC, Jason Jeffory wrote:
>> On Monday, 11 January 2016 at 20:17:23 UTC, Jason Jeffory 
>> wrote:
>>> Any ideas? Happens when I do a very simple dub project and 
>>> try to compile using the MS linker(x86 but set in sc.ini or 
>>> 64). I'm linking in glfw(using correct arch of course)
>>>
>>>
>>> {
>>> 	"name": "Test",
>>> 	"description": "A minimal D application.",
>>> 	"copyright": "Copyright © 2016, Jason",
>>> 	"authors": ["Jason"],
>>> 	"lflags" : ["+C:\\Dlang\\Libs\\glfw3.lib"],
>>> 	"dflags-dmd": [""],
>>> 	"versions-x86_64": ["UseAmd64Impl"],
>>> 	"dependencies": {
>>> 	}
>>> }
>>
>> seems "versions-x86_64": ["UseAmd64Impl"],
>>
>> doesn't actually make it 64
>>
>>                                        ******
>> Performing "debug" build using dmd for x86.
>> midimonitor ~master: building configuration "application"...
>> Linking...
>> Microsoft (R) Incremental Linker Version 14.00.23506.0
>> Copyright (C) Microsoft Corporation.  All rights reserved.
>>
>> LINK : fatal error LNK1104: cannot open file '_CMDLINE'
>> --- errorlevel 1104
>> dmd failed with exit code 1104.
>>
>> Sheesh, why is it so hard to do simple stuff?
>
> There's nothing hard about it. It's just a matter of learning 
> what's what.
>

Um, if there was proper documentation, this wouldn't be a problem.

> First, don't set 32/64-bit compilation in sc.ini. In fact, you 
> should generally never touch sc.ini (more on that below). If 
> you are calling DMD directly, just pass -m64 on the command 
> line. If you are using DUB, pass -ax86_64 on the command line.
>

I don't set that in sc.ini, but you have to set the correct 
paths. It works fine with VS/VD.

I also don't want to pass a command line to dub. Too much work. 
What if I forget? What about the correct libs?  What if I forget 
to type dub -ax86_64 and it tries to compile in the 64-bit lib in 
the lib's path in sc.ini?(yes, it needs to be edited for global 
library locations).


> Second, you don't need to set your own version flag for 64-bit. 
> Both x86_64 and Win64 are already predefined [1]. The latter is 
> only defined on when compiling for 64-bit Windows (Win32 is 
> only defined when compiling for 32-bit Windows, unlike in the C 
> world where the #defined _WIN32 means the Win32 API is 
> available). Should you need to, you can also distinguish 
> between the two Windows runtimes via the CRuntime_DigitalMars 
> and CRuntime_Microsoft versions.
>

This was a mistake, because I got the wrong info from some forum 
post that was wrong.


So, how do I set the json to compile for x64?



More information about the Digitalmars-d-learn mailing list