LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-18-2006, 12:22 PM   #1
spinal2
Member
 
Registered: Oct 2006
Posts: 30

Rep: Reputation: 15
problem with compling


hi i have installed the g2 graphic library
but the problem is that i don't know how to complie a program in which i use this library
 
Old 10-18-2006, 12:25 PM   #2
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 60
what language?
you would compile it the same way you compile other programs of this language

Last edited by nadroj; 10-18-2006 at 12:26 PM.
 
Old 10-18-2006, 02:40 PM   #3
spinal2
Member
 
Registered: Oct 2006
Posts: 30

Original Poster
Rep: Reputation: 15
i use the language c on linux suse and i use the g2 graphic i mean the include <g2.h>
 
Old 10-18-2006, 02:45 PM   #4
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 60
what about the include? what have you tried and what is the error (if any) you are receiving.
does this help

Last edited by nadroj; 10-18-2006 at 02:47 PM.
 
Old 10-18-2006, 02:51 PM   #5
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
can you tell us what errors you get?

edit> oops, i should have refreshed.. i didnt see your post nadroj

Last edited by xhi; 10-18-2006 at 02:52 PM.
 
Old 10-18-2006, 03:05 PM   #6
spinal2
Member
 
Registered: Oct 2006
Posts: 30

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by nadroj
what about the include? what have you tried and what is the error (if any) you are receiving.
does this help
sorry man but i can't figure out how can i compile with gcc in that web site

a freind of mine said that i must find documentation about how to use gcc with that library
i mean i tape gcc ..........
i don't know what i tape there
 
Old 10-18-2006, 03:10 PM   #7
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 60
can u try the usual way, 'gcc filename.c -o outputFilename'? post the errors you get if any
edit: tape = type?
 
Old 10-18-2006, 03:12 PM   #8
spinal2
Member
 
Registered: Oct 2006
Posts: 30

Original Poster
Rep: Reputation: 15
really i want simply want to draw a line
this is what i want to do is there any way to make it ?
 
Old 10-18-2006, 03:14 PM   #9
spinal2
Member
 
Registered: Oct 2006
Posts: 30

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by nadroj
can u try the usual way, 'gcc filename.c -o outputFilename'? post the errors you get if any
edit: tape = type?
as i said before all what i want is that a library that permits to me to draw a line
how can i do that ?
 
Old 10-18-2006, 03:15 PM   #10
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 60
i really think you should read the documentation on the g2 site to start with. post back logical and detailed results if you need more help, and good luck
 
Old 10-18-2006, 03:19 PM   #11
spinal2
Member
 
Registered: Oct 2006
Posts: 30

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by nadroj
i really think you should read the documentation on the g2 site to start with. post back logical and detailed results if you need more help, and good luck
i have read all the documentation of the g2 library but i don't figure out how to compile a program using that a library .


PS: my real problem is very simple just a code how to draw a line
 
Old 10-18-2006, 04:22 PM   #12
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Post the command you're using to compile.

When you compile a program that uses an external library (i.e. anything but glibc) you must do two things:

1. Include the header file and tell the compiler where look for the header file.
You use the #include directive in the code to pull the header file. The way you surround the filename determines where the compiler looks for it. If you surround the filename with <> (e.g. #include <g2.h>), the compiler looks in default locations (e.g. /usr/include, /usr/local/include). If you surround the filename in double quotes (e.g. #include "g2.h") the compiler looks in the local directory for the header file. You can add locations for the compiler to look for the header file on the compilation command line with the -I argument (e.g. gcc -I /home/user/develop/app/include -o my_app application.c)

2. You must inform the linker to incorporate the library into your program. This is only accomplished through the command line using the -l option. That's a lowercase L (not the number 1). For instance, if your program uses a function in the math library, you must tell the linker to incorporate the math library on the command line. The math library filename is libm.so and it's located in a standard library location (such as /usr/lib, /usr/local/lib). You tell the linker to do this with the -l argument (e.g. gcc -lm -o my_app application.c). Assuming the g2 library you're using is named libg2.so, the compilation command line would use -lg2. The -L argument can be used to add other directories to search for the library file if the library is not installed in a standard location.

Lastly, it should be pointed out that some well-designed software packages utilize the pkg-config utility. The pkg-config utility tells you, the developer, what arguments are necessary to the compiler to use the library. For instance, pkg-config --cflags g2 would return the compiler arguments to perform the initial object code creation. Running pkg-config --libs g2 would give the compiler arguments necessary to link the program with the library. You can combine the two if you want to get all the arguments necessary to compile and link in one command (pkg-config --cflags --libs g2). This will work only if the g2 library supports the pkg-config utility and g2 was installed in standard location so that pkg-config can find the files it needs. Otherwise, you need to figure out the command line arguments manually (through documentation or your own investigation).
 
Old 10-18-2006, 04:35 PM   #13
spinal2
Member
 
Registered: Oct 2006
Posts: 30

Original Poster
Rep: Reputation: 15
thank you man thank you very much
u are the only one who helpes in that problem
i sure god three days and i'm looking for inforamtion
thank you again
 
Old 10-18-2006, 04:49 PM   #14
spinal2
Member
 
Registered: Oct 2006
Posts: 30

Original Poster
Rep: Reputation: 15
Mr mark can you give me a very simple library that permits to me to draw a line
g2 really sucks
 
Old 10-18-2006, 08:35 PM   #15
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
I don't do much graphics programming. The only graphics library I'm even vaguely familiar with is SDL. You can take a look at it here: LibSDL homepage
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
problem compling 2.6 tanalam Red Hat 16 07-10-2006 08:06 AM
urgent:problem reg compling prog using arm-linux-gcc ashok kumar reddy Linux - Kernel 1 06-30-2006 04:46 AM
problem with compling skim Polariz Slackware 2 05-21-2006 10:01 PM
problem in compling kernel 2.6.6 rexhack Linux - Software 0 05-25-2004 02:21 AM
problem compling loadablr module ramya272 Linux - Newbie 11 02-25-2004 09:51 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration