www.digitalmars.com         C & C++   DMDScript  

D - disp.h error - coba.d

reply tantius <tantius_member pathlink.com> writes:
i try to run the example program
#include <disp.h>

int main()
disp_printf("hello world!\r\n");
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 '<'
Sep 19 2003
next sibling parent Brad Anderson <brad sankaty.com> writes:
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
Sep 19 2003
prev sibling parent "Carlos Santander B." <carlos8294 msn.com> writes:
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
Sep 19 2003