Modules/Libraries
Joseph Colton
josephcolton at gmail.com
Tue Jan 2 23:21:09 PST 2007
== Quote from Chris Nicholson-Sauls (ibisbasenji at gmail.com)'s article
> Joseph Colton wrote:
> > I would like to create a module for creating ODF documents using D. I have
> > done this before in Perl and Python, but I was able to easily figure out how
> > to create modules there.
> >
> > I currently have two files that I am trying to get to interface correctly.
> > Here is the first file called ooolib.d:
> >
> > module ooolib;
> > class Calc
> > {
> > public:
> > this()
> > {
> > }
> >
> > char[] echo(char[] name)
> > {
> > return name;
> > }
> > }
> >
> > The second file is called test.d:
> >
> > import std.stdio;
> > import ooolib;
> > void main(char[][] args)
> > {
> > Calc doc = new Calc();
> > writefln(doc.echo("Hello World"));
> > }
> >
> > For some reason I cannot seem to get them to work together. I get a lot
> > errors that claim there are undefined references. I am obviously missing
> > something, does anyone know what I am missing?
> The code itself looks fine. What's your compile command line? Are you
including both
> modules in arguments to the compiler? Something like:
> dmd test.d ooolib.d
> (Not attacking your intelligence. Its just a common first mistake.)
> There's also the Build utility if you worry about command lines getting long.
> http://dsource.org/projects/build
> -- Chris Nicholson-Sauls
Thank you. That solved the problem.
More information about the Digitalmars-d-learn
mailing list