Create a class

Sergey Gromov snake.scaly at gmail.com
Fri Feb 1 14:01:06 PST 2008


Ty Tower Wrote:

> I am trying to create a Transaction class that I can call a blank transaction when needed and fill in the fields then write it to a file .Then I  get the next new one and so on.
> 
> The below compiles an object file but gets stuck in the linker with this message
> It goes OK if I put a "main" in it but I didn't think I had to have a main in a class file?

This is called a module, not a class file.  To compile a module you must
use '-c' switch, just like in C:

dmd -c Transaction.d

which will give you a Transaction.o (or .obj) file to link with later.  Or, if your
project is small, you can supply all the files to the compiler:

dmd App.d Transaction.d Other.d

with only one of the modules containing main(), which results in
App (or App.exe).

SnakE


More information about the Digitalmars-d-learn mailing list