LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 04-07-2004, 05:33 PM   #1
abs
Member
 
Registered: Oct 2003
Posts: 203

Rep: Reputation: 30
CFLAGS library -l and -i


i'm using wingtk. in the makefile, i've got the cflags line as:
CFLAGS=-s -mwindows -mno-cygwin -fnative-struct -mno-cygwin -fnative-struct -IC:\WINGTK\INCLUDE\ -IC:\wingtk\INCLUDE\G__~1 -IC:\WINGTK\INCLUDE\ -LC:\WINGTK\LIB\ -BC:\winGTK\BIN\ -IC:\WINGTK\INCLUDE\GDK -DHAVE_CONFIG_H

i need to add these libs so that my 'program can find it at build time': -lgtk-win32-2.0 -lgdk-win32-2.0 -lgthread-2.0 -lgdi32 -lole32 -luuid -latk-1.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -liconv. where in the line would i put it? does it even come in the cflags part or somewhere else? i added it after the '-fnative-struct' and other include dirs just before '-DHAVE_CONFIG_H'.

as of now, the line is (stripped down):
CFLAGS=-s -mwindows -mno-cygwin -fnative-struct -mno-cygwin -fnative-struct -lpango-1.0 -lintl -liconv -IC:\WINGTK\INCLUDE\ -IC:\WINGTK\INCLUDE\ -LC:\WINGTK\LIB\ -BC:\winGTK\BIN\ -IC:\WINGTK\INCLUDE\GDK -IC:\WINGTK\INCLUDE\gtk-2.0 -IC:\WINGTK\INCLUDE\gtkdeps-2.0 -LC:\WINGTK\LIB\glib-2.0\include -LC:\WINGTK\LIB\gtk-2.0\include -DHAVE_CONFIG_H

i see messages like
Code:
gcc: -lpango-1.0: linker input file unused since linking not done
gcc: -lintl: linker input file unused since linking not done
gcc: -liconv: linker input file unused since linking not done
and the error is:
'C:\WINGTK\BIN\ld.exe: cannot open -lpango-1.0: No such file or directory'
and 'pango-1.0.lib' is in C:\WINGTK\LIB\.

syntax is wrong? most of the makefile stuff on the net is about how they work which i sorta know. was looking for some captured output from a 2.4 kernel recompile for hints on this.

Last edited by abs; 04-07-2004 at 05:39 PM.
 
Old 04-07-2004, 11:01 PM   #2
aluser
Member
 
Registered: Mar 2004
Location: Massachusetts
Distribution: Debian
Posts: 557

Rep: Reputation: 43
most properly things like -lfoo and -Lfoo should go in LDFLAGS, not CFLAGS. -Ifoo can go in CPPFLAGS if you like (That was a dash-eye not dash-ell) and I *think* -ffoo and -mbar can as well.

The 'linker input file unused' business is comming from the fact that you have dash-ell options in CFLAGS, and it's not too big a deal.

if you have '-LC:\WINGTK\LIB -lpango-1.0' in LDFLAGS I would think it would find libpango. You could try some variations like -lpango-1.0.lib or just pango-1.0.lib ..

On *nix, gtk has a utility which spits out cflags and ldflags for you. you use it like

gcc -c `pkg-config gtk+-2.0 --cflags` foo.c
gcc foo.o `pkg-config gtk+-2.0 --libs` -o foo

perhaps there is an equivalent on windows.
 
Old 04-11-2004, 10:03 PM   #3
abs
Member
 
Registered: Oct 2003
Posts: 203

Original Poster
Rep: Reputation: 30
unfortunately, the ` ` structure doesn't expand/run in windows. so i've pasted the outputs of 'pkg-config gtk+-2.0 --cflags' and 'pkg-config gtk+-2.0 --libs' into CFLAGS and LDFLAGS.

these 2 targets in a makefile are interpreted diffrerently, right? 1.
Code:
hello: hello.c
     $(CC) $(CFLAGS) $? $(LDFLAGS) -o $@
it compiles and links each file and then moves to the next.

2.
Code:
all: check
     $(CC) $(CFLAGS) -c $(SRCS)
     $(CC) $(LDFLAGS) $(OBJS) -o $(OUTPUT)
compiles all the files and then links them.

would the sequence used make a big diff to a multi-filed program?

i moved the -l's to LDFLAGS but i get the message:
ld: cannot open -lgtk-win32-2.0: No such file or directory

the dir containing the file has been included and the file's name is gtk-win32-2.0.lib. any other combo i should try?

Last edited by abs; 04-11-2004 at 10:08 PM.
 
  


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
CFLAGS to compile kernel frzburn Linux - Software 4 03-05-2005 05:42 AM
cflags exodist Linux - Software 2 01-14-2005 07:44 PM
What is CFLAGS variable used in Makefiles for? Nerox Programming 3 12-28-2004 05:03 PM
Using CFLAGS and other options vexer Linux From Scratch 7 08-18-2004 09:04 AM
how to unset cflags? shanenin Linux - Software 4 01-25-2004 09:36 PM

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

All times are GMT -5. The time now is 07:30 AM.

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