ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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 ??
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 ??
Last edited by linuxlover1; 04-02-2004 at 05:14 AM.
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.)
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.