PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > linux.debian.user > GCC compiler
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
linux.debian.user debian-user@lists.debian.org.

GCC compiler

Réponse
 
LinkBack Outils de la discussion
Vieux 29/04/2007, 02h50   #1
Iuri Sampaio
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut GCC compiler

Hi,



I tried to compile a C source code, using make command:



The Makefile script is:



BINDIR = ./

LIBDIR = /foo/im/lib/Linux24

INCLUDE = /foo/im/include



CC = gcc

CFLAGS = -g -I$(INCLUDE)

LIBS = $(LIBDIR)/libim.a $(LIBDIR)/libim.so \

-lm -L/usr/X11R6/lib -lX11



OBJS = rotation.c

BIN = rotation



$(BIN): $(OBJS)

$(CC) $(CFLAGS) -o $(BIN) $(OBJS) $(LIBS)



install: $(BIN)

mv $(BIN) $(BINDIR)



clean:

rm -f $(BIN) *.o *~







but then I got this error message when I run make



iuri@server1:~/mat056/AULA28.03.07$ make

gcc -g -I../im2_6_linux24/im/include/ -o quantizacao quantizacao.c
.../im2_6_Linux24/im/lib/Linux24/libim.a
.../im2_6_Linux24/im/lib/Linux24/libim.so -lm -L/u\

sr/X11R6/lib -lX11

quantizacao.c:1:16: error: im.h: No such file or directory

quantizacao.c: In function 'main':

quantizacao.c:12: warning: incompatible implicit declaration of built-in
function 'malloc'

quantizacao.c:22: error: 'IM_TIF' undeclared (first use in this function)

quantizacao.c:22: error: (Each undeclared identifier is reported only once

quantizacao.c:22: error: for each function it appears in.)

make: *** [quantizacao] Error 1

HYPERLINK
"mailto:iuri@server1:~/mat056/AULA28.03.07$"iuri@server1:~/mat056/AULA28.03.
07$









I can see it’s missing the im.h of my gcc lib. Does anyone know how to solve
this problem? Even apt-get any lib that has im.h?



Regards,

iuri sampaio


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.467 / Virus Database: 269.6.1/778 - Release Date: 4/27/2007
1:39 PM


  Réponse avec citation
Vieux 29/04/2007, 04h00   #2
Micha Feigin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: GCC compiler

On Sat, 28 Apr 2007 22:20:08 -0300
"Iuri Sampaio" <iuri.sampaio@gmail.com> wrote:

> Hi,
>
>
>
> I tried to compile a C source code, using make command:
>
>
>
> The Makefile script is:
>
>
>
> BINDIR = ./
>
> LIBDIR = /foo/im/lib/Linux24
>
> INCLUDE = /foo/im/include
>
>
>
> CC = gcc
>
> CFLAGS = -g -I$(INCLUDE)
>
> LIBS = $(LIBDIR)/libim.a $(LIBDIR)/libim.so \
> -lm -L/usr/X11R6/lib -lX11


You are linking against libim twice, once static and once dynamic, what youmay
mean is

LIBS = -L$(LIBDIR) -lim -lm -L/usr/X11R6/lib -lX11

>
>
>
> OBJS = rotation.c
>
> BIN = rotation
>
>
>
> $(BIN): $(OBJS)
>
> $(CC) $(CFLAGS) -o $(BIN) $(OBJS) $(LIBS)
>
>
>
> install: $(BIN)
>
> mv $(BIN) $(BINDIR)
>
>
>
> clean:
>
> rm -f $(BIN) *.o *~
>
>
>
>
>
>
>
> but then I got this error message when I run make
>
>
>
> iuri@server1:~/mat056/AULA28.03.07$ make
>
> gcc -g -I../im2_6_linux24/im/include/ -o quantizacao quantizacao.c
> ../im2_6_Linux24/im/lib/Linux24/libim.a
> ../im2_6_Linux24/im/lib/Linux24/libim.so -lm -L/u\
>
> sr/X11R6/lib -lX11
>
> quantizacao.c:1:16: error: im.h: No such file or directory
>
> quantizacao.c: In function 'main':
>
> quantizacao.c:12: warning: incompatible implicit declaration of built-in
> function 'malloc'
>


Seems like you are not including stdlib.h so malloc is not defined

> quantizacao.c:22: error: 'IM_TIF' undeclared (first use in this function)
>
> quantizacao.c:22: error: (Each undeclared identifier is reported only once
>
> quantizacao.c:22: error: for each function it appears in.)
>
> make: *** [quantizacao] Error 1
>
> HYPERLINK
> "mailto:iuri@server1:~/mat056/AULA28.03.07$"iuri@server1:~/mat056/AULA28.03.
> 07$
>
> I can see it’s missing the im.h of my gcc lib. Does anyone know how to solve
> this problem? Even apt-get any lib that has im.h?
>


what is im.h supposed to be a part of? If you don't know, than where did you
get the code and what's its intent?

There is no debian package that contains im.h or libim.a or libim.so
Only reference I found is national language support for AIX which is a
proprietary UNIX by IBM

>
>
> Regards,
>
> iuri sampaio
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.467 / Virus Database: 269.6.1/778 - Release Date: 4/27/2007
> 1:39 PM
>

  Réponse avec citation
Vieux 29/04/2007, 14h50   #3
Cédric Lucantis
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: GCC compiler

Le dimanche 29 avril 2007 04:56, Micha Feigin a écritÂ:
> On Sat, 28 Apr 2007 22:20:08 -0300
>
> "Iuri Sampaio" <iuri.sampaio@gmail.com> wrote:
> > Hi,
> >
> >
> >
> > I tried to compile a C source code, using make command:
> >
> >
> >
> > The Makefile script is:
> >
> >
> >
> > BINDIR = ./
> >
> > LIBDIR = /foo/im/lib/Linux24
> >
> > INCLUDE = /foo/im/include
> >
> >
> >
> > CC = gcc
> >
> > CFLAGS = -g -I$(INCLUDE)
> >
> > LIBS = $(LIBDIR)/libim.a $(LIBDIR)/libim.so \
> > -lm -L/usr/X11R6/lib -lX11

>
> You are linking against libim twice, once static and once dynamic, what you
> may mean is
>
> LIBS = -L$(LIBDIR) -lim -lm -L/usr/X11R6/lib -lX11
>
> > OBJS = rotation.c
> >
> > BIN = rotation
> >
> >
> >
> > $(BIN): $(OBJS)
> >
> > $(CC) $(CFLAGS) -o $(BIN) $(OBJS) $(LIBS)
> >


Not really an answer, but this is wrong too, you should have something like
this instead:

OBJS = rotation.o

BIN = rotation

$(BIN): $(OBJS)
$(CC) -o $@ $^ $(LIBS)

%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS)

but with only one source file it doesn't really matter

> >
> >
> > install: $(BIN)
> >
> > mv $(BIN) $(BINDIR)
> >
> >
> >
> > clean:
> >
> > rm -f $(BIN) *.o *~
> >
> >
> >
> >
> >
> >
> >
> > but then I got this error message when I run make
> >
> >
> >
> > iuri@server1:~/mat056/AULA28.03.07$ make
> >
> > gcc -g -I../im2_6_linux24/im/include/ -o quantizacao quantizacao.c
> > ../im2_6_Linux24/im/lib/Linux24/libim.a
> > ../im2_6_Linux24/im/lib/Linux24/libim.so -lm -L/u\
> >
> > sr/X11R6/lib -lX11
> >
> > quantizacao.c:1:16: error: im.h: No such file or directory
> >
> > quantizacao.c: In function 'main':
> >
> > quantizacao.c:12: warning: incompatible implicit declaration of built-in
> > function 'malloc'

>
> Seems like you are not including stdlib.h so malloc is not defined
>
> > quantizacao.c:22: error: 'IM_TIF' undeclared (first use in this function)
> >
> > quantizacao.c:22: error: (Each undeclared identifier is reported only
> > once
> >
> > quantizacao.c:22: error: for each function it appears in.)
> >
> > make: *** [quantizacao] Error 1


Strange! What is this quantizacao file ? It doesn't appear in the makefile.

> >
> > HYPERLINK
> > "mailto:iuri@server1:~/mat056/AULA28.03.07$"iuri@server1:~/mat056/AULA28.
> >03. 07$
> >
> > I can see it’s missing the im.h of my gcc lib. Does anyone knowhow to
> > solve this problem? Even apt-get any lib that has im.h?

>
> what is im.h supposed to be a part of? If you don't know, than where did
> you get the code and what's its intent?


Good question Maybe are you looking for libimlib ? (an image manipulation
lib, replacement for libxpm)

>
> There is no debian package that contains im.h or libim.a or libim.so
> Only reference I found is national language support for AIX which is a
> proprietary UNIX by IBM
>
> > Regards,
> >
> > iuri sampaio


--
Cédric Lucantis
  Réponse avec citation
Vieux 29/04/2007, 15h30   #4
Michael Marsh
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: GCC compiler

On 4/29/07, Cédric Lucantis <omer@no-log.org> wrote:
> Le dimanche 29 avril 2007 04:56, Micha Feigin a écrit:
> > On Sat, 28 Apr 2007 22:20:08 -0300
> > "Iuri Sampaio" <iuri.sampaio@gmail.com> wrote:
> > > $(BIN): $(OBJS)
> > >
> > > $(CC) $(CFLAGS) -o $(BIN) $(OBJS) $(LIBS)
> > >

>
> Not really an answer, but this is wrong too, you should have something like
> this instead:
>
> OBJS = rotation.o
>
> BIN = rotation
>
> $(BIN): $(OBJS)
> $(CC) -o $@ $^ $(LIBS)
>
> %.o: %.c
> $(CC) -c -o $@ $< $(CFLAGS)
>
> but with only one source file it doesn't really matter


This rule for %.o is, I believe, identical to the implicit rule. I
always use something like:

SOURCES := rotation.c
or
SOURCES := $(wildcard *.c)

LDFLAGS += $(LIBS)

OBJS := $(patsubst %.c,%.o,$(SOURCES))
BINS := $(patsubst %.o,%,$(OBJS))

default : rotation
or
default : $(BINS)

% : %.o
<tab>$(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)

If I'm using GNU make, I hardly ever use "=" instead of ":=", unless I
really want to define a macro. You're a lot more likely to get what
you expect most of the time, and you can use "+=".

--
Michael A. Marsh
http://www.umiacs.umd.edu/~mmarsh
http://mamarsh.blogspot.com
http://36pints.blogspot.com
  Réponse avec citation
Vieux 29/04/2007, 19h10   #5
John L Fjellstad
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: GCC compiler

"Michael Marsh" <michael.a.marsh@gmail.com> writes:

> If I'm using GNU make, I hardly ever use "=" instead of ":=", unless I
> really want to define a macro. You're a lot more likely to get what
> you expect most of the time, and you can use "+=".


What's the difference? My book on Make mentions "=", but not ":=". I
knew about ":=" but I always thought they were pretty much the same.

--
John L. Fjellstad
web: http://www.fjellstad.org/ Quis custodiet ipsos custodes


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 29/04/2007, 20h40   #6
Cédric Lucantis
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: GCC compiler

Le dimanche 29 avril 2007 19:40, John L Fjellstad a écrit:
> "Michael Marsh" <michael.a.marsh@gmail.com> writes:
> > If I'm using GNU make, I hardly ever use "=" instead of ":=", unless I
> > really want to define a macro. You're a lot more likely to get what
> > you expect most of the time, and you can use "+=".

>
> What's the difference? My book on Make mentions "=", but not ":=". I
> knew about ":=" but I always thought they were pretty much the same.
>


The difference is that the value of a variable defined with := is expanded
immediately, while with = it is only computed when used. Here's an example:

BAR = $(FOO)
FOO = some value

all:
@echo "BAR = $(BAR)"

the BAR variable will here be expanded to "some value", but if you write
BAR := $(FOO) instead, it will be expanded to an empty string because FOOis
undefined at this time. That's why you can only use += with a variable
defined with := , because it wouldn't make sense in the other case. That's
also why (I guess) Michael says that you're more likely to get what you
expect with := , because it's closer to what happens with other scripting
languages. It's true that the = syntax can be quite tricky and is often the
cause of hard to find bugs, but it's also often useful.

This is documented in the make info page, under section 6.5 "How to use
variables/Setting". I don't know if this is specific to gnu make or not.

--
Cédric Lucantis
  Réponse avec citation
Vieux 30/04/2007, 01h10   #7
John L Fjellstad
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: GCC compiler

Cédric Lucantis <omer@no-log.org> writes:

> This is documented in the make info page, under section 6.5 "How to use
> variables/Setting". I don't know if this is specific to gnu make or not.


Thanks. I really appreciate the explaination (I looked it up in my make
book, it the book I have was more generic and not GNU make specific).

--
John L. Fjellstad
web: http://www.fjellstad.org/ Quis custodiet ipsos custodes


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 01h21.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,19168 seconds with 15 queries