Compiling first cairo graphics (hello world) program

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
James186282
Posts: 270
Joined: Tue 08 Sep 2009, 19:14
Location: Minnesota

Compiling first cairo graphics (hello world) program

#1 Post by James186282 »

Hi everyone. I'm a retread from various other computer systems. Windoze, Amiga, AtariTT, and most of my programming experience has been assembler. Ok, so I've got the compiler up and working and doing small routines to print to text to the terminal, beep the speaker, talk to a device on a serial port and so forth. My partner wants me to show him an example of drawing a line on the screen and my friend (and doctor) told me to use the cairo graphics scheme of doing this. I downloaded the "hello.c" source and tried to compile it and got the missing file cairo.h message. I've downloaded the .pet of cairo for users and developers and have a set of .h files but.... I don't grock how to point the compiler to this other then to put a path in my source which I assume is pretty crude?

Sorry to be a putz with so many questions but it always seems to take me a while to get started. Once going I'm better! ;-)

- James

User avatar
James186282
Posts: 270
Joined: Tue 08 Sep 2009, 19:14
Location: Minnesota

#2 Post by James186282 »

BTW I tried the following

g++ -o cairo1 -I/usr/include/cairo cairo1.c
*note this is where the cairo.h really is located /usr/include/cairo
and got
/tmp/cccu1vWh.o: In function 'main':
and then the same long list of undefined reference to things in the cairo.h file such as 'cairo_image_surface_create'

User avatar
James186282
Posts: 270
Joined: Tue 08 Sep 2009, 19:14
Location: Minnesota

Compiling cairo graphics [SOLVED]

#3 Post by James186282 »

I was using the ' ' (quotes) key not the ` ` key to set some of the compiler options I got my little crude line drawing routine to click along and I'm sorry for the frantic questions. I can't quite express how excited I am about this.

A couple of observations. Speed wise this is amazing. I'm told this (4.30) as downloaded from the web is not really "trimmed down" fully for speed! I am really really pleased as its making my "junk" laptop the computer I "used" to love but even more. Because as dumb as I am at figuring things out they CAN be figured out.

One thing that really pleases me which is such a small thing. The computer is not constantly reading the hard disk on its own for unknown reasons. Having a minimum of these "squirrel" programs running in the background is SOoooooo nice...

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#4 Post by amigo »

"g++ -o cairo1 -I/usr/include/cairo cairo1.c"
Try adding -L/path/to/libcairo

Post Reply