Article View: comp.os.os2.programmer
Article #3723P2C and emx/gcc -- some questions
From: alann lopes
Date: Wed, 27 Jan 1993 16:35
Date: Wed, 27 Jan 1993 16:35
95 lines
3430 bytes
3430 bytes
Hi, I'm in the process of converting a few thousand lines
of Turbo Pascal code to c using the P2C translator with
the emx/gcc as the target compiler. Much of the code compiles
fine, but in the process of linking (I think!), I get errors
saying that functions like gotoxy, readkey, etc., are not defined.
I'm linking to libp2c.a and expected these functions to be
implemented in this library. Are these functions not available
in this translation package? Do I have to go in and change these
functions to their c equivalent?
If anyone can give me a hint about how to do this, I'd
truly appreciate it. I just don't want to start replacing
them by hand and then find that there was some problem with
the way I'm doing things and that I've wasted precious time.
Thanks very much for any help -- alann
alann lopes: alopes@ucsd.edu -- internet
(619) 534-5438 ALOPES@UCSD -- bitnet
Below is an Turbo Pascal example, the translated code
and the error messages from the compiler/linker:
-------------------------------------------------------------------------------
Pascal code test program
-------------------------------------------------------------------------------
Program test1;
Uses CRT;
Var
dch : char;
Begin
gotoxy(10,20);
writeln("Hello World");
dch = readkey;
clrscr;
End.
-------------------------------------------------------------------------------
Translated code output from p2c
-------------------------------------------------------------------------------
/* Output from p2c, the Pascal-to-C translator */
/* From input file "test1.pas" */
/* p2c: D:\EMX\P2C/system.imp, line 10: Warning: Symbol 'SYSTEM' was already defined [220]
* Warning: Symbol 'SYSTEM' was already defined [220] */
#include <p2c.h>
main(int argc, Char *argv[])
{
Char dch;
PASCAL_MAIN(argc, argv);
gotoxy(10, 20);
printf("Hello World\n");
ReadKey();
ClrScr();
exit(EXIT_SUCCESS);
}
/* End. */
-------------------------------------------------------------------------------
Messages from p2c during translation
-------------------------------------------------------------------------------
[D:\emx\p2c\rawan]p2c -LTURBO test1.pas
D:\EMX\P2C/system.imp, line 10/2: Warning: Symbol 'SYSTEM' was already defined [220]
Reading import text for "printer"
Reading import text for "dos"
Reading import text for "crt"
Reading import text for "graph"
test1
-------------------------------------------------------------------------------
Messages from gcc during compilation
-------------------------------------------------------------------------------
[D:\emx\p2c\rawan]gcc -o test1.exe -O2 test1.c -lp2c
./ccc00833: Undefined symbol _gotoxy referenced from text segment
./ccc00833: Undefined symbol _ReadKey referenced from text segment
./ccc00833: Undefined symbol _ClrScr referenced from text segment
Technical Details
Message-ID:
<1860@cogsci.ucsd.EDU>Path:
arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!sdd.hp.com!zaphod.mps.ohio-state.edu!howland.reston.ans.net!spool.mu.edu!sol.ctr.columbia.edu!ucsnews.sdsu.edu!network.ucsd.edu!cogsci!lopesShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!sdd.hp.com!zaphod.mps.ohio-state.edu!howland.reston.ans.net!spool.mu.edu!sol.ctr.columbia.edu!ucsnews.sdsu.edu!network.ucsd.edu!cogsci!lopes From: lopes@cogsci.ucsd.EDU (alann lopes) Newsgroups: comp.os.os2.programmer Subject: P2C and emx/gcc -- some questions Keywords: P2C emx/gcc Message-ID: <1860@cogsci.ucsd.EDU> Date: 27 Jan 93 16:35:48 GMT Organization: University of California, San Diego Lines: 98