Can't link libs?

K.K. via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jun 6 09:31:07 PDT 2014


So being a noob and all I've gotten stuck on something stupid...
Whenever I try to compile using DMD, and try to link .lib files I
always get errors like:

"file4.d(2): Error: module file3 is in file 'file3lib\file3.d'
which cannot be read
import path[0] = %cd%\file3
import path[1] = C:\dmd2\Windows\bin\..\..\src\phobos
import path[2] = C:\dmd2\Windows\bin\..\..\src\druntime\import
"

For reference on this I've been using Adam's book and this page:
http://wiki.dlang.org/Compiling_and_linking_with_DMD_on_Windows


I also tried using COFF2OMF and COFFIMPLIB (everytime I used
coffimplib it just said "Error: Missing archive signature")

Here's the code I was working with (plz excuse my lazy
variable/file names, wasn't feeling creative this morning :P):

File3.d which I turned into a .lib
---------------------------------
module file3lib.file3;;;
import std.stdio;

class shit
{
	int lead;
	this(int y){lead += y;}
	int fuck(int x)
	{
		lead += x;
		return lead;
	}
}

/*
void main()
{
	auto okay = new shit(10);
	writeln(okay.fuck(2));
}
*/
----------------------------------

file4.d
----------------------------------
module file4;
import file3lib.file3;
import std.stdio;

void main()
{
	auto thing = new shit(2);
	writeln(thing.fuck(2));
}
----------------------------------



I tried using different names, and making extra directories but
that didn't help much ofcourse..
+I know there's that weird thing I did with file3lib & file3, but
I swapped that around a bunch of times with no success.
Everything's just been getting messier as I go on.

I've sortof just been going in circles so if anyone could point
out what I'm doing wrong it'd be a huge help! :)


More information about the Digitalmars-d-learn mailing list