Обсуждение: compilation problem

Поиск
Список
Период
Сортировка

compilation problem

От
HS
Дата:
Hi:

I'm doing a university project with postgres. I need to add a C++ file to the postgres optimizer. When I added this file (XXX.cc), I got make errors.
To figure out the problem I did some simple tests. I removed everything in the file except for a simple function and changed the CPP variable in Makefile.gloabl from gcc to g++ and it worked. However, when I add #include <iostream> or calls to cout, etc to my file, I get link errors. I'd appreciate it if anyone could help me with this problem (adding a C++ file that uses some C++ libraries to postrges). I'm using postgres 8 on Debian.

Thanks,
HSA

Re: compilation problem

От
Tom Lane
Дата:
HS <mhossein@gmail.com> writes:
> I'd appreciate it if anyone could help me with this problem (adding a
> C++ file that uses some C++ libraries to postrges).

Learn to write plain C --- the backend is not a C++ program and cannot
readily be turned into one.

            regards, tom lane

Re: compilation problem

От
HS
Дата:
The problem is that I have to use a statistical library which is written in C++. My own code is in plain C.
If I compile the library source code separately and make the object file using gcc, is there a way that I can change the postgres make files to link that .o file to postgres (considering teh fact that the .o file's source file was in C++)?

Thanks,
Hossein

On 10/12/05, Tom Lane <tgl@sss.pgh.pa.us> wrote:
HS <mhossein@gmail.com> writes:
> I'd appreciate it if anyone could help me with this problem (adding a
> C++ file that uses some C++ libraries to postrges).

Learn to write plain C --- the backend is not a C++ program and cannot
readily be turned into one.

                        regards, tom lane