issue importing std.file or std.stdio on win x64 build.

Jonathan Villa via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Dec 2 13:47:09 PST 2015


Hello,

I've been trying to program and app that writes its own log, so, 
to deal with files I tried using std.file. But with just adding 
the import std.file; it throws me (AFAIK) a link error:

(some texts are in spanish, I tried to translate the important 
thing)
Building Release\ASI.exe...
libucrt.lib(fgetc.obj) : error LNK2005: already defined 
_fgetc_nolock in phobos64.lib(stdio_374_54d.obj)
phobos64.lib(stdio_374_54d.obj) : error LNK2019: extern symbol 
_filbuf [unresolved referred in the function] _fgetc_nolock
Release\ASI.exe : fatal error LNK1120: 1 externos sin resolver
Building Release\ASI.exe failed!

This only happens with x64 build, in x86 works fine, but I want 
to stick with x64 as much as possible. So I did some research to 
get some kind of alternative and I found that std.stdio has a 
File class to work with, I implemented it, but now throws me the 
following:

(some texts are in spanish, I tried to translate the important 
thing)
Building Release\ASI.exe...
phobos64.lib(stdio_373_566.obj) : error LNK2019: extern symbol 
_flsbuf [unresolved referred in the function] _fputc_nolock
Release\ASI.exe : fatal error LNK1120: 1 externos sin resolver
Building Release\ASI.exe failed!

I did some research again, and the _flsbuf function is in:
https://github.com/D-Programming-Language/druntime/blob/6f6ec7f4706b128bffaefe9145bec9581e2e7d39/src/rt/msvc.c
at line 94.

_fgetc_nolock is in msvc.c (druntime) and std/stdio.d as well 
(phobos lib).

What can I do to resolve this issue? Using std.stdio looks like 
it should be easier to resolve, BUT in the future I want to 
implement some file/directory management and std.file can do that 
job, so advices to get rid of the first problem would be my first 
priority.

I'm using VisualD 0.3.43 on Visual Studio Community 2015.
Any kind of advice will be appreciated.
Thanks.


More information about the Digitalmars-d-learn mailing list