I tried to create a separate module for storing classes in, this is the new module
<code>
module qlib.classes;

//QLib.Classes
class tstrlist{
private:
        string[] list;
        uint taken;
public:
        string read(uint index){
                return list[index];
        }
        void set(uint index, string str){
                if (index>=list.length){
                        list[index]=str;
                }
        }
        void add(string str){
                list.length++;
                list[list.length-1]=str;
        }
}
</code>
and the project's code
<code>
module main;

//import std.stdio;
import qlib.classes;

void main(){
        tstrlist slst = new tstrlist();
        //slst.add("str1");
        //readln;
}
</code>

And this is what I get after compile:
<code>
Building: LrnD (Release)
Performing main compilation...
Current dictionary: /home/nafees/Desktop/Projects/LrnD/LrnD
dmd -O -release "main.d" "-I/usr/include/dmd" "-I/home/nafees/Desktop/Projects/DLibrary" "-odobj/Release" "-of/home/nafees/Desktop/Projects/LrnD/LrnD/bin/Release/LrnD" -w -vcolumns
obj/Release/LrnD.o: In function `_Dmain':
main.d:(.text._Dmain+0x9): undefined reference to `_D4qlib7classes8tstrlist7__ClassZ'
collect2: error: ld returned 1 exit status
--- errorlevel 1
Exit code 1
Build complete -- 1 error, 0 warnings

---------------------- Done ----------------------

Build: 1 error, 0 warnings
</code>

Reply via email to