how to link self made lib using dub
Flaze07
christianseiji.cs at gmail.com
Fri Jul 6 17:08:48 UTC 2018
I have been trying to link self made .lib, and have tried to use
it several times, I failed..
so, here I have a file in this path :
Z:\programming\D\usefulFiles\experiment\source\output.d
it has
module output;
class Output {
public:
static void write( string msg ) {
import std.stdio;
writeln( msg );
}
}
and then I compiled it into library using dub project with this
file in a path : Z:\programming\D\usefulFiles\experiment\dub.json
{
"name" : "experiment",
"targetType": "library",
"targetPath": "lib",
"sourcePaths": [
"source",
],
}
then, I made a project, with this main in this path :
Z:\programming\D\experimentLib\source\main.d
it contains this
module main;
import std.stdio;
import source.output;
void main( string[] args ) {
Output.write( "lol" );
readln();
}
and then, I have a dub file in this path :
Z:\programming\D\experimentLib\dub.json
it contains :
{
"name" : "experimentlib",
"targetType": "executable",
"targetPath": "bin",
"importPaths": [
"Z:\\programming\\D\\usefulFiles\\experiment\\",
],
"lflags": [
"+Z:\\programming\\D\\usefulFiles\\experiment\\lib\\",
],
}
so, I have made lflags to include the lib in experiment, but
still, it failed to linker ( it compiles fine, but the linker
fails )
More information about the Digitalmars-d-learn
mailing list