[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: pslib: c++ linking



On Sat, 13 Nov 2004, Thomas Ruschival wrote:

> Hi, as far as I know I can link all C libraries in C++ as
>  well. but I can't get it done with pslib. the exactly same
>  code compiles and links with C and it doesn't when I
>  use C++.
>  This is my linking command:
>  gcc -o test -L/usr/lib/ -lps -lstdc++ test.cpp
>
>  and in /usr/lib is definitely the file
>  /usr/lib/libps.so -> libps.so.0.2.4
>
>  it all works fine when I compile my file as test.c as C
>  code. but with test.cpp I get these errors:
>
>  /tmp/ccSuItDe.o(.text+0x11): In function `main':
>  : undefined reference to `PS_boot()'
>  /tmp/ccSuItDe.o(.text+0x16): In function `main':
>  : undefined reference to `PS_new()'
>  [bla bla bla and so on......................]
>  collect2: ld returned 1 exit status
>
>  this is the stupid little piece of code I wrote after the
>  bigger project didn't compile:
>
>  main(int argc, char *argv[]) {
>  PSDoc* sheet;
>  PS_boot();
>  sheet = PS_new();
>  PS_open_file(sheet,"test.ps");
>  PS_set_info(sheet,"Title","HelloWorld");
>  PS_begin_page(sheet,841.9,595.3);
>  PS_end_page(sheet);
>  PS_shutdown();
>  };
>
>  what do I do wrong. BTW, I have debian [sid] running.
>

Try using:

extern "C" {
#include <libps/pslib.h>
}

If this works it's a pslib bug and you should report it.

Xavier



Reply to: