Probleme mit gcc

Dieses Thema im Forum "Software" wurde erstellt von chrism, 26. April 2005.

  1. chrism

    chrism New Member

    Hallo,

    ich habe mir mal Xcode installiert um ein bißchen C++ zu programmieren. Bei folgendem "Hello, world" Programm bekomme ich aber einen ganzen Haufen Fehlermeldungen, mit denen ich nichts anfangen kann:

    #include <iostream>
    using namespace std;

    int main() {
    cout << "Hello, world!" << endl;
    return 0;
    }


    Bei der C Variante

    #include <stdio.h>

    int main(int argc, char *argv[]) {
    printf("Hello, world\n");
    return 0;
    }

    bekomme ich die Meldung:
    test.c:1:18: stdio.h: No such file or directory

    Die konnte ich bisher per Suche auch nirgendwo finden. Unter Linux konnte ich mit gcc3.3 beide Programme problemlos übersetzen.

    Weiß jemand weiter?
    Vielen Dank für die Hilfe,

    Christian

    Und hier die g++ Fehlermeldung:

    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
    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
     
  2. PeterG

    PeterG New Member

    Hast Du das direkt im Terminal kompiliert (bzw. versucht)?
     
  3. chrism

    chrism New Member

    ja, ich habe direkt

    g++ test.cpp

    bzw.

    gcc test.c

    eingegeben
     
  4. PeterG

    PeterG New Member

    Irgendwie findet der Compiler die Header-Files nicht. Kannst ja mal von Hand suchen, ob sie da sind.

    > find /usr -name stdio.h -print

    oder zur Not überall suchen

    > find / -name stdio.h -print
     
  5. chrism

    chrism New Member

    stdio.h ist einfach nicht da. Ich habe Xcode über den Installer meines iBooks installiert und sowohl gcc3.3 als auch gcc3.1 getestet. Beiden fehlt die Include Datei. Ich werde demnächst wohl mal das Paket Xcode Packet von Apple runterladen, wenn ich meine Abneigung gegen die Annmeldung mit Adresse überwunden habe :rolleyes:
     
  6. cblasi

    cblasi New Member

    Hi,

    stdio.h ist unter

    /usr/include

    oder

    /Developer/SDKs/MacOSX10.3.0.sdk/usr/include/stdio.h

    zu finden, and BTW probier mal "#locate stdio.h"

    //christiano
     
  7. MacGenie

    MacGenie Quad Mac User

Diese Seite empfehlen