Convert Pascal to C
hello everyone !
I am looking a Pascal to C converter application. I have found p2c and ptoc but they doesnt work for me. I want to convert free pascal to C. Any other ideas ?? Thx in advance ! |
In what way don't they work for you?
|
p2c converts the .pas to.c but with many many errors.Lets say that my app is 2000 lines the p2c does 2000 mistakes in tha translation.
PtoC , when i call it, it promts "Can't open configuration file 'ptoc.cfg' " and "error: can't open input source file: ptoc.pas " |
Are you talking plain old wirth, or is the
thing you're trying to convert objectPascal or Delphi or something the like? Cheers, Tink |
I am just trying to convert a simple Turbo Pascal program.
This program i wrote it with free pascal compiler and i use no libararies , no units....etc just simple pascal commands. p2c translates the code to C but....gcc finds one error or more errors on each line ! 2000 lines ---> 2000 or more errors ! I cant go through the translated code and corrrect them, i havent that much time. Is there any other Pascal tou C/C++ converter out there exept p2c ?? |
ive just tried it and it seems ok, what sort of errors are you getting?
|
The translation seems ok...maybe the gcc is incompatible with the translated c code.
This is an example . eg. Pascal code: Program Hello; Begin Writeln('Hello world'); End. Converted Code (C): /* Output from p2c 1.21alpha-07.Dec.93, the Pascal-to-C translator */ /* From input file "test.pas" */ #include <p2c/p2c.h> main(argc, argv) int argc; Char *argv[]; { PASCAL_MAIN(argc, argv); printf("Hello world\n"); exit(EXIT_SUCCESS); } /* End. */ GCC errors: test.c:5:21: p2c/p2c.h: No such file or directory test.c: In function `main': test.c:10: error: syntax error before "Char" test.c:14: error: `EXIT_SUCCESS' undeclared (first use in this function) test.c:14: error: (Each undeclared identifier is reported only once test.c:14: error: for each function it appears in.) Thx for the help ! |
by linuxlover1
test.c:5:21: p2c/p2c.h: No such file or directory there ya go, the c file produced needs p2c.h and its not there, that means either your include directories are set up wrong or p2c has been installed incorrectly. search your include directories to find p2c.h and the when compiling pass the directory to the compiler, you'll also need to do the same with the library libp2c on my system p2c is installed in /usr so i compile with gcc file.c -lp2c but if your p2c is installed in an odd place say /opt/p2c then you would need to compile with gcc -I/opt/p2c/include -L/opt/p2c/lib file.c -lp2c |
thx for the help dude !
|
All times are GMT -5. The time now is 10:05 AM. |