pb ld et gcc

Le
unbewust
j'ai un :

UnixUtils.h
qui déclare une tripotée de fonctions
un :
UnixUtils.c
qui les implémentes **TOUTES**

ensuite un UnixUtils_Test.c dans le cas il n'y a qu'un main, ce
fichier fait bien sûr un include de "ext/UnixUtils.c"


à la compil j'ai les erreurs suivantes :
%> ./compil
../ext/UnixUtils.c: In function get_dirname:
../ext/UnixUtils.c:215: warning: return discards qualifiers from
pointer target type
../ext/UnixUtils.c:217: warning: return discards qualifiers from
pointer target type

~/work/C/rmovefile/test%> ./UnixUtils_test ./Users/yt/bin/../work/./
C////
path = ///Users/yt/bin/../work/C//// -o-> /Users/yt/work/C =
normalized path
path = Users/yt/bin/../work/C//// -o-> Users/yt/work/C = normalized
path
path = ./Users/yt/bin/../work/C//// -o-> Users/yt/work/C = normalized
path
path = ../Users/yt/bin/../work/C//// -o-> ../Users/yt/work/C =
normalized path
path = ./a_script -o-> ./a_script = normalized path
~/work/C/rmovefile/test%> ./
compil
../ext/UnixUtils.c: In function get_dirname:
../ext/UnixUtils.c:215: warning: return discards qualifiers from
pointer target type
../ext/UnixUtils.c:217: warning: return discards qualifiers from
pointer target type
../ext/UnixUtils.h:13: warning: unixPathExists used but never defined
/usr/bin/ld: Undefined symbols:
_unixPathExists
collect2: ld returned 1 exit status

~/work/C/rmovefile/test%> ./compil
../ext/UnixUtils.c: In function get_dirname:
../ext/UnixUtils.c:207: warning: return discards qualifiers from
pointer target type
../ext/UnixUtils.c:209: warning: return discards qualifiers from
pointer target type
../ext/UnixUtils.h:13: warning: unixPathExists used but never defined
/usr/bin/ld: Undefined symbols:
_unixPathExists
collect2: ld returned 1 exit status

~/work/C/rmovefile/test%> ./compil
../ext/UnixUtils.c: In function get_dirname:
../ext/UnixUtils.c:207: warning: return discards qualifiers from
pointer target type
../ext/UnixUtils.c:209: warning: return discards qualifiers from
pointer target type
../ext/UnixUtils.h:13: warning: unixPathExists used but never defined
/usr/bin/ld: Undefined symbols:
_unixPathExists
collect2: ld returned 1 exit status

~/work/C/rmovefile/test%> ./compil
../ext/UnixUtils.c: In function get_dirname:
../ext/UnixUtils.c:207: warning: return discards qualifiers from
pointer target type
../ext/UnixUtils.c:209: warning: return discards qualifiers from
pointer target type
../ext/UnixUtils.h:13: warning: unixPathExists used but never defined
/usr/bin/ld: Undefined symbols:
_unixPathExists
collect2: ld returned 1 exit status

~/work/C/rmovefile/test%> ./compil
../ext/UnixUtils.c: In function get_dirname:
../ext/UnixUtils.c:207: warning: return discards qualifiers from
pointer target type
../ext/UnixUtils.c:209: warning: return discards qualifiers from
pointer target type

~/work/C/rmovefile/test%> ./UnixUtils_test ./Users/yt/bin/../work/./
C////
Path normalization:
path = ///Users/yt/bin/../work/C//// -o-> /Users/yt/work/C =
normalized path
path = Users/yt/bin/../work/C//// -o-> Users/yt/work/C = normalized
path
path = ./Users/yt/bin/../work/C//// -o-> Users/yt/work/C = normalized
path
path = ../Users/yt/bin/../work/C//// -o-> ../Users/yt/work/C =
normalized path
path = ./a_script -o-> ./a_script = normalized path

Path exists?:
~/work/C/rmovefile/test%> ./
compil
../ext/UnixUtils.c: In function get_dirname:
../ext/UnixUtils.c:207: warning: return discards qualifiers from
pointer target type
../ext/UnixUtils.c:209: warning: return discards qualifiers from
pointer target type
../ext/UnixUtils.h:13: warning: unixPathExists used but never defined
/usr/bin/ld: Undefined symbols:
_unixPathExists
collect2: ld returned 1 exit status

~/work/C/rmovefile/test%> ./compil
../ext/UnixUtils.c: In function get_dirname:
../ext/UnixUtils.c:207: warning: return discards qualifiers from
pointer target type
../ext/UnixUtils.c:209: warning: return discards qualifiers from
pointer target type
../ext/UnixUtils.h:13: warning: unixPathExists used but never defined
../ext/UnixUtils.h:14: warning: isUnixRegFile used but never defined
/usr/bin/ld: Undefined symbols:
_isUnixRegFile
_unixPathExists
collect2: ld returned 1 exit status

~/work/C/rmovefile/test%> ./compil
../ext/UnixUtils.c: In function get_dirname:
../ext/UnixUtils.c:207: warning: return discards qualifiers from
pointer target type
../ext/UnixUtils.c:209: warning: return discards qualifiers from
pointer target type
../ext/UnixUtils.h:13: warning: unixPathExists used but never defined
../ext/UnixUtils.h:14: warning: isUnixRegFile used but never defined
../ext/UnixUtils.h:15: warning: isUnixDirectory used but never defined
/usr/bin/ld: Undefined symbols:
_isUnixDirectory
_isUnixRegFile
_path_basename
_path_dirname
_unixPathExists
collect2: ld returned 1 exit status

~/work/C/rmovefile/test%> ./compil > ~/Desktop/compil.txt
../ext/UnixUtils.c: In function get_dirname:
../ext/UnixUtils.c:207: warning: return discards qualifiers from
pointer target type
../ext/UnixUtils.c:209: warning: return discards qualifiers from
pointer target type
../ext/UnixUtils.h:13: warning: unixPathExists used but never defined
../ext/UnixUtils.h:14: warning: isUnixRegFile used but never defined
../ext/UnixUtils.h:15: warning: isUnixDirectory used but never defined
/usr/bin/ld: Undefined symbols:
_isUnixDirectory
_isUnixRegFile
_path_basename
_path_dirname
_unixPathExists
collect2: ld returned 1 exit status
~/work/C/rmovefile/test%> ./compil 2>&1 ~/Desktop/compil.txt
../ext/UnixUtils.c: In function get_dirname:
../ext/UnixUtils.c:207: warning: return discards qualifiers from
pointer target type
../ext/UnixUtils.c:209: warning: return discards qualifiers from
pointer target type
../ext/UnixUtils.h:13: warning: unixPathExists used but never defined
../ext/UnixUtils.h:14: warning: isUnixRegFile used but never defined
../ext/UnixUtils.h:15: warning: isUnixDirectory used but never defined
/usr/bin/ld: Undefined symbols:
_isUnixDirectory
_isUnixRegFile
_path_basename
_path_dirname
_unixPathExists
collect2: ld returned 1 exit status

~/work/C/rmovefile/test%> ./compil
../ext/UnixUtils.c: In function get_dirname:
../ext/UnixUtils.c:207: warning: return discards qualifiers from
pointer target type
../ext/UnixUtils.c:209: warning: return discards qualifiers from
pointer target type
../ext/UnixUtils.h:13: warning: unixPathExists used but never defined
../ext/UnixUtils.h:14: warning: isUnixRegFile used but never defined
../ext/UnixUtils.h:15: warning: C used but never defined
/usr/bin/ld: Undefined symbols:
_isUnixDirectory
_isUnixRegFile
_path_basename
_path_dirname
_unixPathExists
collect2: ld returned 1 exit status


pourtant unixPathExists, isUnixRegFile, isUnixRegFile et path_basename
sont tous bien définis, de la même manière dans le .h et le .c
correspondant

alors je pense que c'est ma commande gcc qui n'est pas bonne , la
voici :
#! /usr/bin/env zsh

echo `gcc -o UnixUtils_test -framework Foundation ../ext/UnixUtils.c
UnixUtils_test.c`

exit 0

ma hiérarchie de rep :

ext/
UnixUtils.c
UnixUtils.h
test
UnixUtils_test.c

ci qq'un a des lumières
Questions / Réponses high-tech
Vidéos High-Tech et Jeu Vidéo
Téléchargements
Vos réponses
Gagnez chaque mois un abonnement Premium avec GNT : Inscrivez-vous !
Trier par : date / pertinence
Vincent Lefevre
Le #2450071
Dans l'article unbewust
j'ai un :

UnixUtils.h
qui déclare une tripotée de fonctions
un :
UnixUtils.c
qui les implémentes **TOUTES**

ensuite un UnixUtils_Test.c dans le cas il n'y a qu'un main, ce
fichier fait bien sûr un include de "ext/UnixUtils.c"


Tu fais un #include d'un fichier .c??? Ce n'est pas que c'est
interdit, mais ne t'étonne pas d'avoir des problèmes...

--
Vincent Lefèvre 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)

Publicité
Poster une réponse
Anonyme