Importing C libraries under Linux

BlitzMax Forums/BlitzMax Programming/Importing C libraries under Linux

Scaremonger(Posted 2015) [#1]
Hi,

I'm usually a Windows Programmer, but attempting to add Linux CUPS support to my Printer Module is causing me major problems before I've even written the glue code!

I started on this project by checking that my libraries were all correct by using the following sample program:

I compiled it using GCC on the command line as follows and it works fine:
 gcc -o cupstest `cups-config --cflags` cupstest.c `cups-config --libs`

Satisfied that my install was correct; I turned to the required libraries. The GCC command line takes input from the output of "cups-config" in two calls. The first call doesn't return anything on my system, but the second returns a list of libraries and compiler options:
$ cups-config --cflags

$ cups-config --libs
-lcups -Wl,-Bsymbolic-functions -Wl,-z,relro -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lgnutls -lgcrypt -lz -lpthread -lm -lcrypt -lz

Knowing which libraries are linked; I started with Blitzmax and this is where my Linux knowledge is lacking severely:
Import "-lcups"

I get this error:
Linking:Linux-list-printers.debug.mt
/usr/bin/ld: cannot find -lcups
collect2: error: ld returned 1 exit status

Any suggestions!


Brucey(Posted 2015) [#2]
You'll need to install the cups dev package - it includes the libcups.so that you appear to need.


Scaremonger(Posted 2015) [#3]
Hi Brucey,

Thanks for your suggestion; I'd already installed cups, libcups2, libcups2-dev so did a search for libcups.so as your suggested I need and eventually I figured out the problem... I have 64bit installed and I needed 32bit for it to compile...

$ sudo apt-get install libcups2-dev:i386


Now I can start working on the module properly. :)


Fielder(Posted 2015) [#4]
Glad to hear this :)


Fielder(Posted 2016) [#5]
Any NEWS Scaremonger?


Fielder(Posted 2016) [#6]
can you just make 0.5 version windows-only compatible?