gcc funktioniert nicht...

D

DanielD

Guest
Hallo Forum,
ich habe mir die Xcode Tools auf meinem IBook installiert aber wenn ich ein einfaches Hallo Welt Programm compilen möchte kriege ich die folgende Fehlermeldung. Ich hoffe das ihr mir helfen könnt.

Gruß Daniel D.

Code:
In file included from /usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/c++locale.h:41,
                 from /usr/include/gcc/darwin/3.3/c++/iosfwd:46,
                 from /usr/include/gcc/darwin/3.3/c++/ios:44,
                 from /usr/include/gcc/darwin/3.3/c++/ostream:45,
                 from /usr/include/gcc/darwin/3.3/c++/iostream:45,
                 from test.cpp:1:
/usr/include/gcc/darwin/3.3/c++/clocale:49:20: locale.h: No such file or directory
In file included from /usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/c++locale.h:41,
                 from /usr/include/gcc/darwin/3.3/c++/iosfwd:46,
                 from /usr/include/gcc/darwin/3.3/c++/ios:44,
                 from /usr/include/gcc/darwin/3.3/c++/ostream:45,
                 from /usr/include/gcc/darwin/3.3/c++/iostream:45,
                 from test.cpp:1:
/usr/include/gcc/darwin/3.3/c++/clocale:57: error: `lconv' not declared
/usr/include/gcc/darwin/3.3/c++/clocale:58: error: `setlocale' not declared
/usr/include/gcc/darwin/3.3/c++/clocale:59: error: `localeconv' not declared
In file included from /usr/include/gcc/darwin/3.3/c++/iosfwd:47,
                 from /usr/include/gcc/darwin/3.3/c++/ios:44,
                 from /usr/include/gcc/darwin/3.3/c++/ostream:45,
                 from /usr/include/gcc/darwin/3.3/c++/iostream:45,
                 from test.cpp:1:
/usr/include/gcc/darwin/3.3/c++/cctype:49:19: ctype.h: No such file or directory
In file included from /usr/include/gcc/darwin/3.3/c++/iosfwd:47,
                 from /usr/include/gcc/darwin/3.3/c++/ios:44,
                 from /usr/include/gcc/darwin/3.3/c++/ostream:45,
                 from /usr/include/gcc/darwin/3.3/c++/iostream:45,
                 from test.cpp:1:
/usr/include/gcc/darwin/3.3/c++/cctype:100: error: `tolower' not declared
/usr/include/gcc/darwin/3.3/c++/cctype:101: error: `toupper' not declared
In file included from /usr/include/gcc/darwin/3.3/c++/cstdio:50,
                 from /usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/c++io.h:35,
                 from /usr/include/gcc/darwin/3.3/c++/bits/fpos.h:44,
                 from /usr/include/gcc/darwin/3.3/c++/iosfwd:49,
                 from /usr/include/gcc/darwin/3.3/c++/ios:44,
                 from /usr/include/gcc/darwin/3.3/c++/ostream:45,
                 from /usr/include/gcc/darwin/3.3/c++/iostream:45,
                 from test.cpp:1:
/usr/include/gcc/darwin/3.3/c++/cstddef:48:20: stddef.h: No such file or directory
In file included from /usr/include/gcc/darwin/3.3/c++/cstdio:50,
                 from /usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/c++io.h:35,
                 from /usr/include/gcc/darwin/3.3/c++/bits/fpos.h:44,
                 from /usr/include/gcc/darwin/3.3/c++/iosfwd:49,
                 from /usr/include/gcc/darwin/3.3/c++/ios:44,
                 from /usr/include/gcc/darwin/3.3/c++/ostream:45,
                 from /usr/include/gcc/darwin/3.3/c++/iostream:45,
                 from test.cpp:1:
/usr/include/gcc/darwin/3.3/c++/cstddef:52: error: `ptrdiff_t' not declared
/usr/include/gcc/darwin/3.3/c++/cstddef:53: error: `size_t' not declared
In file included from /usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/c++io.h:35,
                 from /usr/include/gcc/darwin/3.3/c++/bits/fpos.h:44,
                 from /usr/include/gcc/darwin/3.3/c++/iosfwd:49,
                 from /usr/include/gcc/darwin/3.3/c++/ios:44,
                 from /usr/include/gcc/darwin/3.3/c++/ostream:45,
                 from /usr/include/gcc/darwin/3.3/c++/iostream:45,
                 from test.cpp:1:
/usr/include/gcc/darwin/3.3/c++/cstdio:52:19: stdio.h: No such file or directory
In file included from /usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/c++io.h:35,
                 from /usr/include/gcc/darwin/3.3/c++/bits/fpos.h:44,
                 from /usr/include/gcc/darwin/3.3/c++/iosfwd:49,
                 from /usr/include/gcc/darwin/3.3/c++/ios:44,
                 from /usr/include/gcc/darwin/3.3/c++/ostream:45,
                 from /usr/include/gcc/darwin/3.3/c++/iostream:45,
                 from test.cpp:1:
/usr/include/gcc/darwin/3.3/c++/cstdio:99: error: `FILE' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:100: error: `fpos_t' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:102: error: `clearerr' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:103: error: `fclose' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:104: error: `feof' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:105: error: `ferror' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:106: error: `fflush' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:107: error: `fgetc' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:108: error: `fgetpos' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:109: error: `fgets' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:110: error: `fopen' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:111: error: `fprintf' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:112: error: `fputc' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:113: error: `fputs' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:114: error: `fread' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:115: error: `freopen' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:116: error: `fscanf' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:117: error: `fseek' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:118: error: `fsetpos' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:119: error: `ftell' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:120: error: `fwrite' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:121: error: `getc' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:122: error: `getchar' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:123: error: `gets' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:124: error: `perror' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:125: error: `printf' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:126: error: `putc' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:127: error: `putchar' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:128: error: `puts' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:129: error: `remove' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:130: error: `rename' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:131: error: `rewind' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:132: error: `scanf' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:133: error: `setbuf' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:134: error: `setvbuf' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:135: error: `sprintf' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:136: error: `sscanf' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:137: error: `tmpfile' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:138: error: `tmpnam' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:139: error: `ungetc' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:140: error: `vfprintf' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:141: error: `vprintf' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:142: error: `vsprintf' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:155: error: `snprintf' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:156: error: `vfscanf' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:157: error: `vscanf' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:158: error: `vsnprintf' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:159: error: `vsscanf' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:164: error: `snprintf' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:165: error: `vfscanf' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:166: error: `vscanf' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:167: error: `vsnprintf' not declared
/usr/include/gcc/darwin/3.3/c++/cstdio:168: error: `vsscanf' not declared
In file included from /usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr.h:98,
                 from /usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/c++io.h:37,
                 from /usr/include/gcc/darwin/3.3/c++/bits/fpos.h:44,
                 from /usr/include/gcc/darwin/3.3/c++/iosfwd:49,
                 from /usr/include/gcc/darwin/3.3/c++/ios:44,
                 from /usr/include/gcc/darwin/3.3/c++/ostream:45,

                 from /usr/include/gcc/darwin/3.3/c++/iostream:45,
                 from test.cpp:1:
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:37:21: pthread.h: No such file or directory
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:38:20: unistd.h: No such file or directory
In file included from /usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr.h:98,
                 from /usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/c++io.h:37,
                 from /usr/include/gcc/darwin/3.3/c++/bits/fpos.h:44,
                 from /usr/include/gcc/darwin/3.3/c++/iosfwd:49,
                 from /usr/include/gcc/darwin/3.3/c++/ios:44,
                 from /usr/include/gcc/darwin/3.3/c++/ostream:45,
                 from /usr/include/gcc/darwin/3.3/c++/iostream:45,
                 from test.cpp:1:
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:40: error: syntax
   error before `;' token
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:41: error: syntax
   error before `;' token
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:42: error: syntax
   error before `;' token
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:450: error: `
   __gthread_once_t' was not declared in this scope
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:450: error: `
   once' was not declared in this scope
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:450: error: `
   func' was not declared in this scope
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:450: error: parse
   error before `)' token
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:450: error: `
   __gthread_once' declared as an `inline' variable
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:450: error: syntax
   error before `)' token
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:459: error: `
   __gthread_key_t' was not declared in this scope
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:459: error: `key
   ' was not declared in this scope
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:459: error: `
   dtor' was not declared in this scope
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:459: error: parse
   error before `*' token
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h: In function `
   int __gthread_key_create(...)':
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:465: error: `
   __gthread_key_t' undeclared (first use this function)
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:465: error: (Each
   undeclared identifier is reported only once for each function it appears 
   in.)
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:465: error: parse
   error before `,' token
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:466: error: cannot
   declare static function inside another function
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h: In function `
   int __gthread_key_dtor(...)':
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:468: error: `ptr
   ' undeclared (first use this function)
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:469: error: `key
   ' undeclared (first use this function)
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:469: error: `
   pthread_setspecific' undeclared (first use this function)
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:475: error: parse
   error before `)' token
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:476: error: cannot
   declare static function inside another function
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h: In function `
   int __gthread_key_delete(...)':
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:477: error: `
   pthread_key_delete' undeclared (first use this function)
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:481: error: parse
   error before `)' token
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:482: error: cannot
   declare static function inside another function
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h: In function `
   void* __gthread_getspecific(...)':
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:483: error: `
   pthread_getspecific' undeclared (first use this function)
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:487: error: parse
   error before `,' token
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:488: error: cannot
   declare static function inside another function
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h: In function `
   int __gthread_setspecific(...)':
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:493: error: `
   __gthread_mutex_t' undeclared (first use this function)
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:493: error: `
   mutex' undeclared (first use this function)
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:494: error: `
   __gthread_mutex_lock' declared as an `inline' variable
/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/gthr-default.h:494: confused by earlier errors, bailing out
 
welche header-dateien hast du included?
gib uns am besten den ganzen den source code und die paramter vom compiler-aufruf.

tolower wird dein 'hello world' ja kaum brauchen, also wird mehr dahinter stecken...

ausserdem suche locale.h im include-verzeichnis. hast du libc drauf?
 
Hi, wie gesagt nur ein einfaches hallo welt.

Code:
#include <iostream>
using namespace std;

int main() {
        cout << "hallo" << endl;
        return 0;
}

g++ hallo.cpp -o hallo

Code:
daniels-ibook-g4:/usr/include/gcc/darwin/3.3/c++ daniel$ ls
algorithm               cstring                 list
backward                ctime                   locale
bits                    cwchar                  map
bitset                  cwctype                 memory
cassert                 cxxabi.h                new
cctype                  debug                   numeric
cerrno                  deque                   ostream
cfloat                  exception               ppc-darwin
ciso646                 exception_defines.h     queue
climits                 ext                     set
clocale                 fstream                 sstream
cmath                   functional              stack
complex                 iomanip                 stdexcept
csetjmp                 ios                     streambuf
csignal                 iosfwd                  string
cstdarg                 iostream                typeinfo
cstddef                 istream                 utility
cstdio                  iterator                valarray
cstdlib                 limits                  vector
 
probiere mal, ob der gcc mit nem C-hello-world funktioniert.

sieht danach aus, als ob der g++ nicht das C-Include-Directory mit einbindet.
Das kannst du mit g++ ....... -I<Pfad> ändern.
den pfad gibts über `find /usr -name 'stdio.h'`
 
PS. wenn keine suchergebnisse zu vorhanden sind, dann fehlt dir die C-bibliothek.
 
Habs jetzt mit einem C Hallo Welt versucht aber funktioniert auch nicht ich glaub die stdio.h ist gar nicht vorhanden zumindest finde ich nichts in dem include ordner

Code:
daniels-ibook-g4:~ daniel$ gcc test.cpp -o test
test.cpp:1:19: stdio.h: No such file or directory
test.cpp: In function `int main()':
test.cpp:4: error: `printf' undeclared (first use this function)
test.cpp:4: error: (Each undeclared identifier is reported only once for each 
   function it appears in.)

Ich weiss jetzt nicht ob du dich mit Mac`s auskennst aber wenn vielleicht doch, kannst du mir mal sagen wie ich gcc gescheit installieren kann?
 
hmm... nimm OpenBSD, NetBSD, Linux oder sowas. Läuft doch auch prima auf Mac. Und der gcc wird es auch tun.

Also das die stdio.h nicht dabei ist ist schon strange. Schau, ob du libc installieren kannst (gibt sicherlich nen Package). vielleicht heißt es auch "C-Bibliothek" oder "C-Header-Dateien" oder so ähnlich.

Mach ein find /usr/include -name 'stdio.h'
und dann mach aus deinem gcc aufruf folgendes (wenn er das findet):

gcc -o test test.c -I/usr/include/<verzeichnis-zur-stdio.h-datei>

dann sollte es gehen.

und als lösung für die zukunft:

kopiere die c-header-dateien (inkl. subverzeichnisse wie sys) nach /usr/include/

ifh hoffe, das klappt. oder arbeite mit symlinks (=softlinks), falls MacOS sowas unterstützt.
 
Installiere XTools und lass die Hände von selbstinstallierten gcc's.
Eventuell installiere über fink.

Ansonsten willkommen in der Welt von OSS und autoconf Krankheiten.
Vielleicht ist es nur ein kleines Flag was fehlt, im Endeffekt aber egal weil es genauso viel Zeit kostet wie ein schwerer Fehler.

Sowas ist immer wieder der Grund für mich auf das gute alte Windows und MacOSX zu setzen und proprietäre Software zu mögen.
 
naja, wenn macos keine vernünftige installation von einem gcc-package hinbekommt, dann ist das echt arm. gcc installiert man auf vielen systemen gar nicht mehr explizit. und wenn man das package installiert, dann läuft es ohne weitere bemühungen perfekt.
 
Sorry das ist bullshit. Ich hab soviele Probleme mit gcc gehabt, nicht nur versuche die 4.0 auf Panther zu installieren, auch auf Solaris gabs Probleme und nicht hinzubekommen. Selbst auf OpenBSD kannste ein problemfreies "configure;make;make install" (was wegen des make nicht im source verzeichnis features sowieso ja nicht geht) vergessen.

Autoconf, Automake, Libtool und der ganze andere Dreck ist so was für die Tonne. Vergiss es. Es sollte verboten werden, dann würden a) die Programmierer gezwungen werden ihren Code zu cleanen und b) die OS Bastler gezwungen werden ihre Headerfile Katastrophen mal unter Kontrolle zu bekommen.

Viele Grüsse von jemand der unter "Windows, MacOSX, Solaris, Linux" programmieren muss und wohl auch demnächst mit "FreeBSD, OpenBSD, NetBSD und HP-UX" anfängt.
 
Ich hatte noch nie Probleme damit, Solaris mit dem gcc zu verwenden. Man läd sich einfach die Packages von sunfreeware.com (oder wie die URL war...) und es läuft prima. Ok, man muss leider ein paar unnütze Sachen beachten (strings.h, zusätzliches linken für die socket-spielereien, ...), die es bei anderen unix'es nicht gibt, aber der gcc läuft erstmal prima.

Unter OpenBSD hatte ich auch meine autotools Probleme und anschließend keine Lust mehr drauf. Ich habe mir dann mein configure-script selbst geschrieben, was recht umständlich war, weil es schon damit anfängt, dass es nicht unter jedem Unix ein -n Parameter für /bin/echo gibt usw. Die Autotools legen ausserdem eine Menge von blöden Dateien an, die ich persönlich nicht haben möchte. In dem Punkt kann ich dir zustimmen.

Aber unter Windows, wenns geht noch mit .NET rumbastelln... nee danke. Das durfte ich im Studium gleich im 1. Semester machen und ich hasse es. Aber Solaris, Linux, BSD... ich finde, das geht wirklich super... wenn man erstmal... die ganzen Eigenheiten kennt und drauf eingehen kann.
 
Ja wenn ich bei sunfreeware.com ein compiliertes Packet finde dann ist es ja auch einfach. Aber versuche mal nach einer Ankündigung einer neuen Version mal das tgz runterzuladen und selbst zu kompilieren. Das klappt fast nie sondern mann muss irgendwie 2 Monate warten bis andere es geschaft haben und die Bugfixes wieder eingearbeitet wurden.

Jede kommerzielle Bananensoftware ist im Gegensatz dazu immer noch meilenweit voraus. Rechne einfach mal mit 20 Euro pro Stunde und du siehst was das mit der TCO von OSS ist.

Die Alternative wäre ja nicht .NET sonder mal stabile Binärpackete und ein vernünftiges Packagemangement das wie unter Windows dupliziert und nicht immer fordert das ich so alles auf den neuesten Stand bringe. Und natürlich etwas weniger Bananensoftware von den - es ist doch kostenlos also hör auf zu meckern - Idioten. Es ist kostenlos aber es hat die Konkurrenz vernichtet also muss ich es benutzen und daher erwarte ich auch viel Verantwortung und das heisst schweiss und tränen - hätten sich die Ärsche ja vorher überlegen sollen ob die das kostenlos machen.
 
Zurück
Oben