Menu

CDLGI

2004-06-26
2012-09-26
  • Nobody/Anonymous

    i downloaded the CDLGI package but it seems that it cant work in 4.9.8.10....
    i tried to compile the template but got the followings:
    378 C:\Dev-Cpp\include\winbgim.h
    parse error before "ismouseclick"
    378 C:\Dev-Cpp\include\winbgim.h
    [Warning] data definition has no type or storage class
    379 C:\Dev-Cpp\include\winbgim.h
    parse error before '&' token

    thx~

     
    • Anonymous

      Anonymous - 2004-06-26

      In my copy of winbgim.h, ismouseclick() is declared at line 389, not 378 as in yours. You may have a different or modified version, (or I may have). The comment header in mine says:

      // WINBGIM Version 3.4 -- Dec 21, 1999

      Post the lines around the reported error location, say 370 to 380.

      The mouse functions all use a defined type UINT, they are the only functions that do, which is probably the problem here - it is not being defined. It is defined in windef.h, which should have been included indirectly via windows.h which should have been included near the top on winbgim.h. If it is missing either add it or get a fresh unbroken copy.

      Clifford

       
    • Nobody/Anonymous

      i installed the copy of yours and got the same errors.

      389 C:\Dev-Cpp\include\winbgim.h
      parse error before "ismouseclick"
      389 C:\Dev-Cpp\include\winbgim.h
      [Warning] data definition has no type or storage class
      390 C:\Dev-Cpp\include\winbgim.h
      parse error before '&' token

      code of the template:
      #include <winbgim.h>

      int main()
      {
           initwindow(640,480); //open a 640x480 graphics window
          setcolor(WHITE); 
          circle(320,240,100); //Draw a circle
           getch();   //wait for user to press a key
           closegraph();        //close graphics window
           return 0;
      }

       
    • Anonymous

      Anonymous - 2004-06-26

      If only to test the hypothesis, replace the instances of UINT with unsigned int or add the lines:

      #if !defined UINT
      typedef unsigned int UINT ;
      #endif

      After windows.h is included.

      If it works, you have to wonder what happened to UINT ? Are your windows.h and windef.h files intact and unmodified?

      Clifford

       
    • Nobody/Anonymous

      it doesnt work......
      it only generates 2 more warnings:
      44 C:\Dev-Cpp\include\winbgim.h
      [Warning] redefinition of `UINT'
      244 C:\Dev-Cpp\include\windef.h
      [Warning] `UINT' previously declared here

      i havent modified those files.i am using 4.9.8.10 with CDLGI pak updated

       
    • Anonymous

      Anonymous - 2004-06-26

      OK, UINT definition is not the problem. I've just built the devpack template sucessfully in 4.9.8.10.

      I have however discovered what your problem is. I reproduced exactly your problem by changing the DevPack template project to build as C arther than C++ code.

      ismouseclick() is defined as returning type bool. This type is not valid in C. You need to build the project as C++ code.

      To fix this: Project|Project options...|Files, select the source file/files and check the "Compile as C++".

      If you really wish to use the C compiler, you will need to rebuid the library from source since it will have C++ linkage. There is no disadvantage in using a C++ compiler for C code or non-OO C++ code. In fact it is probably better since C++ has stronger type error checking.

      Clifford

       
    • Nobody/Anonymous

      thanks very much~
      but i get a few linker errors:

      [Linker error] undefined reference to `initwindow'
      [Linker error] undefined reference to `setcolor'
      [Linker error] undefined reference to `circle'
      [Linker error] undefined reference to `closegraph'

       
      • Wayne Keen

        Wayne Keen - 2004-06-26

        Could you post your full compile log please?

        Wayne

         
    • Nobody/Anonymous

      Compiler: Default compiler
      Executing  g++.exe...
      g++.exe "C:\Documents and Settings\ChiuLun\Desktop\testing.c" -o "C:\Documents and Settings\ChiuLun\Desktop\testing.exe"    -I"C:\Dev-Cpp\include"   -L"C:\Dev-Cpp\lib"
      C:\DOCUME~1\ChiuLun\LOCALS~1\Temp/ccCkaaaa.o(.text+0x2c):testing.c: undefined reference to `initwindow'
      C:\DOCUME~1\ChiuLun\LOCALS~1\Temp/ccCkaaaa.o(.text+0x39):testing.c: undefined reference to `setcolor'

      C:\DOCUME~1\ChiuLun\LOCALS~1\Temp/ccCkaaaa.o(.text+0x50):testing.c: undefined reference to `circle'
      C:\DOCUME~1\ChiuLun\LOCALS~1\Temp/ccCkaaaa.o(.text+0x5d):testing.c: undefined reference to `closegraph'

      Execution terminated

       
    • Anonymous

      Anonymous - 2004-06-26

      You have to explicitly link the winbgim library. You have not done so.

      If you had created a project in the following manner:

      File|New|Project...|Other|Console GDI you shoukld have none of these problems.

      Otherwise in your existing project:

      Project|Project options|Parameters, then in the linker options box you should have:

      -lbgi -lgdi32 -luser32 -mwindows

      Clifford

       
    • Wayne Keen

      Wayne Keen - 2004-06-26

      I note also that you have your source code stored in a directory with spaces in it.

      C:\Documents and Settings\ChiuLun\Desktop\testing.c

      This is not I believe related to your current problem, but it will bite you eventually, and hard.  I keep my projects in

      c:\mycstuff

      Wayne

       
    • Nobody/Anonymous

      can you tell me what a Console GDI is?
      i created the project as a console application.

      i will keep my projects in a new directory then.

      ^^ thanks~

       
      • Anonymous

        Anonymous - 2004-06-27

        Console GDI is the template for CLGDI (not CDLGI as you wrote it).

        GDI stands for Graphics Device Interface, it is the standard Windows 2D drawing API. Normally it is used in GUI apps, but with a little work (done for you in this library), it can be used in Console Mode applications (applications with a main() function, and no Windows message loop).

        WinBGIm emulates the Borland BGI DOS graphics interface (because GDI is much more complex).

        It is documented here: http://www.cs.colorado.edu/~main/bgi/doc/ the functions marked WIN are either extensions or behave differently that the BGI counterparts.

        Clifford

         
    • Nobody/Anonymous

      i have one more quetion.when i use getch(),it seems that it doesnt get any input from the keyboard.the most strange thing is when i replace the #include <winbgim.h> with <conio.h>,getch() functions again.i read the winbgim.h header and found #include <conio.h> inside.what is the problem?

       
    • Nobody/Anonymous

      Hi,

      I tried to get this working too, but with no luck.
      I also got the

      [Linker error] undefined reference to `initwindow'
      [Linker error] undefined reference to `setcolor'
      [Linker error] undefined reference to `circle'
      [Linker error] undefined reference to `closegraph'

      here but didnt managed to solve it with the given link parameters and the compile log errors went worse..
      whats wrong here?

      Compiler: Default compiler
      Building Makefile: "C:\Tools\C-Compile\Dev-Cpp\Makefile.win"
      Fhrt  make... aus
      make.exe -f "C:\Tools\C-Compile\Dev-Cpp\Makefile.win" all
      g++.exe -D__DEBUG__ Templates/main.o Blubber_private.res -o "Blubber.exe" -L"C:/TOOLS/C-COMPILE/DEV-CPP/lib" -mwindows -lbgi -lgdi32 -luser32 -mwindows 

      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x37a5): In function `putimage':
      winbgim.cpp:1669: undefined reference to `__builtin_vec_new'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x3834):winbgim.cpp:1672: undefined reference to `endl(ostream &)'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x3841):winbgim.cpp:1672: undefined reference to `cerr'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x3846):winbgim.cpp:1672: undefined reference to `ostream::operator<<(char const *)'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x3898):winbgim.cpp:1677: undefined reference to `endl(ostream &)'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x38a5):winbgim.cpp:1677: undefined reference to `cerr'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x38aa):winbgim.cpp:1677: undefined reference to `ostream::operator<<(char const *)'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x38f2):winbgim.cpp:1683: undefined reference to `endl(ostream &)'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x38ff):winbgim.cpp:1683: undefined reference to `cerr'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x3904):winbgim.cpp:1683: undefined reference to `ostream::operator<<(char const *)'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x3965):winbgim.cpp:1686: undefined reference to `endl(ostream &)'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x3972):winbgim.cpp:1686: undefined reference to `cerr'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x3977):winbgim.cpp:1686: undefined reference to `ostream::operator<<(char const *)'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x39a8):winbgim.cpp:1689: undefined reference to `endl(ostream &)'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x39b5):winbgim.cpp:1689: undefined reference to `cerr'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x39ba):winbgim.cpp:1689: undefined reference to `ostream::operator<<(char const *)'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x3a1b):winbgim.cpp:1692: undefined reference to `endl(ostream &)'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x3a28):winbgim.cpp:1692: undefined reference to `cerr'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x3a2d):winbgim.cpp:1692: undefined reference to `ostream::operator<<(char const *)'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x3c06): In function `getimage':

      winbgim.cpp:1731: undefined reference to `endl(ostream &)'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x3c13):winbgim.cpp:1731: undefined reference to `cerr'

      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x3c18):winbgim.cpp:1731: undefined reference to `ostream::operator<<(char const *)'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x3c47):winbgim.cpp:1734: undefined reference to `endl(ostream &)'

      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x3c54):winbgim.cpp:1734: undefined reference to `cerr'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x3c59):winbgim.cpp:1734: undefined reference to `ostream::operator<<(char const *)'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x3cd4):winbgim.cpp:1738: undefined reference to `endl(ostream &)'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x3ce1):winbgim.cpp:1738: undefined reference to `cerr'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text+0x3ce6):winbgim.cpp:1738: undefined reference to `ostream::operator<<(char const *)'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text$__tf3ios+0x29): In function `_tf7ostream':

      winbgim.cpp: undefined reference to `__rtti_si'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text$__tf9streambuf+0x29):winbgim.cpp: undefined reference to `__rtti_si'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text$__tf7filebuf+0x29):winbgim.cpp: undefined reference to `__rtti_si'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text$__tf7ostream+0x28):winbgim.cpp: undefined reference to `__rtti_class'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text$__tf7istream+0x28):winbgim.cpp: undefined reference to `__rtti_class'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text$__tf8iostream+0x30):winbgim.cpp: undefined reference to `__rtti_class'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text$__tf22_IO_istream_withassign+0x28):winbgim.cpp: undefined reference to `__rtti_class'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text$__tf22_IO_ostream_withassign+0x28):winbgim.cpp: undefined reference to `__rtti_class'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text$__tf11_ios_fields+0x1d):winbgim.cpp: undefined reference to `__rtti_user'

      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text$__tf8_IO_FILE+0x1d):winbgim.cpp: undefined reference to `__rtti_user'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text$__10char_queuei+0x27):winbgim.cpp: undefined reference to `__builtin_vec_new'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text$_$_10char_queue+0x1a):winbgim.cpp: undefined reference to `__builtin_vec_delete'
      C:/TOOLS/C-COMPILE/DEV-CPP/lib/libbgi.a(winbgim.o.b)(.text$_$_10char_queue+0x31):winbgim.cpp: undefined reference to `__builtin_delete'

      Ausfhrung beendet

      Greetings,

      Fred

       
    • Anonymous

      Anonymous - 2004-06-27

      Fred, you have an old version of the library, or at least a version not adapted or rebuilt for GCC 3.2. You will need to rebuild the library from source. The version you have was probably built with GCC 2.95 or earlier which does not place the standard library in the std namespace, so the links to the standard library are not compatible with v3.x

      Also this is not really the same problem, you should not hijack other users threads.

      Clifford.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.