Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2002-02

Problems with the GRAPH Unit

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Daniel Grün

Hi!

I've got problems compiling Pascal applications using the GRAPH unit. SVGALIB and SVGALIB-DEVEL are installed on my Mandrake Linux system. Trying to compile the first example program in the GRAPH-Unit-Documentation for Linux I get the following error:

Free Pascal Compiler version 1.0.4 [2001/05/22] for i386 Copyright (c) 1993-2000 by Florian Klaempfl
Target OS: Linux for i386
Compiling inigraph1.pas
inigraph1.pas(5,13) Note: Local variable LO not used inigraph1.pas(5,17) Note: Local variable HI not used inigraph1.pas(6,4) Note: Local variable FOUND not used Assembling inigraph1
Linking inigraph1
/usr/lib/libvga.a(mouse.o): In function `ms_init': mouse.o(.text+0x6b5): undefined reference to `pow' inigraph1.pas(33) Warning: Error while linking
Closing script ppas.sh
32 Lines compiled, 0.1 sec

I get the same message (well, only the error while linking is the same) with all console-vga-graphic Pascal sourcodes I'm trying to compile. inigraph1.pas(33) is the line below "end.". The sourcecode is:

Program inigraph1; { Program to demonstrate static graphics mode selection }
uses graph;
const
  TheLine = 'We are now in 640 x 480 x 256 colors!'+
            ' (press <Return> to continue)';
var
  gd, gm, lo, hi, error,tw,th: integer;
  found: boolean;
begin
  { We want an 8 bit mode }
  gd := D8bit;
  gm := m640x480;
  initgraph(gd,gm,'');
  { Make sure you always check graphresult! }
  error := graphResult;
  if (error  grOk) Then
    begin
    writeln('640x480x256 is not supported!');
    halt(1)
    end;
  { We are now in 640x480x256 }
  setColor(cyan);
  rectangle(0,0,getmaxx,getmaxy);
  { Write a nice message in the center of the screen }
  setTextStyle(defaultFont,horizDir,1);
  tw:=TextWidth(TheLine);
  th:=TextHeight(TheLine);
  outTextXY((getMaxX - TW) div 2,
            (getMaxY - TH) div 2,TheLine);
  { Wait for return }
  readln;
  { Back to text mode }
  closegraph;
end.

I didn't find anything helpful yet.

Daniel Gruen

Reply by email

Jonas Maebe
to Daniel Grün
Daniel Grün wrote 7 lines
Assembling inigraph1 Linking inigraph1 /usr/lib/libvga.a(mouse.o): In function `ms_init': mouse.o(.text+0x6b5): undefined reference to `pow' inigraph1.pas(33) Warning: Error while linking Closing script ppas.sh 32 Lines compiled, 0.1 sec

This looks like a bug in the svgalib you are using. Can you successfully compile C programs that use svgalib?

Jonas

Reply by email

Michael Van Canneyt
to Jonas Maebe
Jonas Maebe wrote 13 lines
On zondag, februari 3, 2002, at 02:40 , Daniel Gr�n wrote: > Assembling inigraph1 > Linking inigraph1 > /usr/lib/libvga.a(mouse.o): In function `ms_init': > mouse.o(.text+0x6b5): undefined reference to `pow' > inigraph1.pas(33) Warning: Error while linking > Closing script ppas.sh > 32 Lines compiled, 0.1 sec This looks like a bug in the svgalib you are using. Can you successfully compile C programs that use svgalib?

Pow is in the math library, which should be linked in:

add

{$linklib m}

To your program file.

Michael.

Reply by email

Daniel Grün

Hi!

Show quoted text 12 lines
> Assembling inigraph1 > Linking inigraph1 > /usr/lib/libvga.a(mouse.o): In function `ms_init': > mouse.o(.text+0x6b5): undefined reference to `pow' > inigraph1.pas(33) Warning: Error while linking > Closing script ppas.sh > 32 Lines compiled, 0.1 sec This looks like a bug in the svgalib you are using. Can you successfully compile C programs that use svgalib? Jonas

Thank you for asking. No, I tried it now but I can't. Several errors with "Undefined Reference". I will reinstall svgalib and try again.

Daniel Gruen

Reply by email