home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / os2 / programm / 8110 < prev    next >
Encoding:
Text File  |  1993-01-29  |  3.3 KB  |  109 lines

  1. Path: 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
  2. From: lopes@cogsci.ucsd.EDU (alann lopes)
  3. Newsgroups: comp.os.os2.programmer
  4. Subject: P2C and emx/gcc -- some questions
  5. Keywords: P2C emx/gcc
  6. Message-ID: <1860@cogsci.ucsd.EDU>
  7. Date: 27 Jan 93 16:35:48 GMT
  8. Organization: University of California, San Diego
  9. Lines: 98
  10.  
  11. Hi, I'm in the process of converting a few thousand lines
  12. of Turbo Pascal code to c using the P2C translator with
  13. the emx/gcc as the target compiler. Much of the code compiles
  14. fine, but in the process of linking (I think!), I get errors
  15. saying that functions like gotoxy, readkey, etc., are not defined.
  16.  
  17. I'm linking to libp2c.a and expected these functions to be
  18. implemented in this library. Are these functions not available
  19. in this translation package? Do I have to go in and change these
  20. functions to their c equivalent?
  21.  
  22. If anyone can give me a hint about how to do this, I'd
  23. truly appreciate it. I just don't want to start replacing
  24. them by hand and then find that there was some problem with
  25. the way I'm doing things and that I've wasted precious time.
  26.  
  27. Thanks very much for any help -- alann
  28.  
  29.  
  30.    alann lopes:        alopes@ucsd.edu       -- internet
  31.    (619) 534-5438      ALOPES@UCSD           -- bitnet
  32.  
  33.  
  34. Below is an Turbo Pascal example, the translated code
  35. and the error messages from the compiler/linker:
  36.  
  37. -------------------------------------------------------------------------------
  38. Pascal code test program
  39. -------------------------------------------------------------------------------
  40. Program test1;
  41.  
  42. Uses CRT;
  43.  
  44. Var
  45.  dch : char;
  46.  
  47. Begin
  48.  
  49. gotoxy(10,20);
  50. writeln("Hello World");
  51. dch = readkey;
  52. clrscr;
  53.  
  54. End.
  55.  
  56. -------------------------------------------------------------------------------
  57. Translated code output from p2c
  58. -------------------------------------------------------------------------------
  59.  
  60. /* Output from p2c, the Pascal-to-C translator */
  61. /* From input file "test1.pas" */
  62. /* p2c: D:\EMX\P2C/system.imp, line 10: Warning: Symbol 'SYSTEM' was already defined [220]
  63.  * Warning: Symbol 'SYSTEM' was already defined [220] */
  64.  
  65.  
  66. #include <p2c.h>
  67.  
  68.  
  69. main(int argc, Char *argv[])
  70. {
  71.   Char dch;
  72.  
  73.   PASCAL_MAIN(argc, argv);
  74.   gotoxy(10, 20);
  75.   printf("Hello World\n");
  76.   ReadKey();
  77.   ClrScr();
  78.  
  79.   exit(EXIT_SUCCESS);
  80. }
  81.  
  82.  
  83.  
  84. /* End. */
  85.  
  86.  
  87. -------------------------------------------------------------------------------
  88. Messages from p2c during translation
  89. -------------------------------------------------------------------------------
  90. [D:\emx\p2c\rawan]p2c -LTURBO test1.pas 
  91. D:\EMX\P2C/system.imp, line 10/2: Warning: Symbol 'SYSTEM' was already defined [220]
  92. Reading import text for "printer"
  93. Reading import text for "dos"
  94. Reading import text for "crt"
  95. Reading import text for "graph"
  96. test1
  97.  
  98. -------------------------------------------------------------------------------
  99. Messages from gcc during compilation
  100. -------------------------------------------------------------------------------
  101. [D:\emx\p2c\rawan]gcc -o test1.exe -O2 test1.c -lp2c 
  102.  
  103. ./ccc00833: Undefined symbol _gotoxy referenced from text segment
  104. ./ccc00833: Undefined symbol _ReadKey referenced from text segment
  105. ./ccc00833: Undefined symbol _ClrScr referenced from text segment
  106.  
  107.  
  108.  
  109.