Thread overview
disp.h error - coba.d
Sep 19, 2003
tantius
Sep 19, 2003
Brad Anderson
September 19, 2003
i try to run the example program
#include <disp.h>

int main()
{
disp_open();
disp_printf("hello world!\r\n");
disp_close();
return 0;
}

it has error like this

C:\My Documents\D\coba.d(1): #line integer ["filespec"]\n expected
C:\My Documents\D\coba.d(1): Declaration expected, not '<'




September 19, 2003
tantius wrote:
> i try to run the example program
> #include <disp.h>
> 
> C:\My Documents\D\coba.d(1): #line integer ["filespec"]\n expected
> 

You must write disp.d yourself to wrap the C header file into D.  Then at the top of your coba.d file, use import instead of #include <disp.h>:

import disp;

There are two useful guides to doing this disp.h to disp.d conversion:
Walter's:  http://www.digitalmars.com/d/htomodule.html
Mike Wynn's:  http://www.l8night.co.uk/mwynn/d/deimos.html

Any time the D compiler sees #, it will give the #line integer error, because in D, there is no preprocessor.

Hope this helps.
BA

September 19, 2003
Andy Friesen wrote a small console library. I modified it so it supports functions in disp.h. In http://earth.prohosting.com/carlos3/console.html you can find that modified console library, including disp.d.

————————————————————————— Carlos Santander


---

Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.518 / Virus Database: 316 - Release Date: 2003-09-11