locale.h kann nicht gefunden werden

A

AlexKoeppe

Mitglied
Thread Starter
Dabei seit
25.09.2005
Beiträge
22
Reaktionspunkte
0
Hallo,
ich versuche gerade mein erstes C++ Programm auf meinem neuen Mac zum laufen zu bekommen. Doch leider scheitere ich schon an "Hello World" mit 97 Fehlern :)

Beim einbinden von iostream kommt beim backen ein Fehler in der iostream.h
Code:
#include <locale.h> //No such File or Directory

Ich habe die DeveloperTools und den gcc-3.3 installiert.

Habe ich etwas vergessen?

Gruß Alex
 
Hallo,

wie sieht dein Hallo Welt aus?

Baust Du mit Kommandozeile oder mit Xcode?

Gruss

Alex
 
Der Spezifikation zufolge sollten C++-Header nicht mehr die Endung „.h“ haben. Emtweder entbehrt der entsprechende C++-Header diese Endung oder er heißt gar ganz anders.
Allerdings wüßte ich auch nicht, wozu man für ein Hello-World-Programm die locale.h bräuchte?!


Änderung: Habe mal einen peinlichen Tippfehler korrigiert. :D
 
Zuletzt bearbeitet:
Ulfrinn schrieb:
Dem Spezifikation zufolge sollten C++-Header nicht mehr die Endung „.h“ haben.

Es sind aber auch in ISO C++ noch die C Header (.h) dabei. Sie Deklarieren die Methoden sowohl im std wie auch im global Namespace (ohne .h nur std Namespace) (Siehe INCITS/ISO/IEC 14882-2003, Anhang D 5)

Aber ohne das eigentliche Programm ist das alles Raterei.

Gruss

Alex
 
below schrieb:
Es sind aber auch in ISO C++ noch die C Header (.h) dabei. Sie Deklarieren die Methoden sowohl im std wie auch im global Namespace (ohne .h nur std Namespace) (Siehe INCITS/ISO/IEC 14882-2003, Anhang D 5)
Auch mal was dazugelernt, danke. :) Ich dachte immer, die seinen ganz von der Bildfläche verschwunden.
 
So sieht das Script aus im vi erstellt.
Code:
iBook:~ format_c$ cat HelloWorld.cpp 
#include <iostream>
using namespace std;
int main() {
        cout << "Hello World\n";
        return 0;
}

iBook:~ format_c$
und mit
Code:
gcc-3.3 HelloWorld.cpp
kompiliert. Da kommen die selben Fehlermeldungen als wenn ich das programm in ein C++ Tool - Projekt von XCode kompilieren will.

Gruss Alex
 
Du musst g++ nutzen nicht gcc. gcc ist der Compiler für C.

Also in deinem Fall g++-3.3.
 
Jetzt dachte ich schon ich wüsste fast alles, aber offenbar ist g++ nicht äquivalent zu gcc -x c++

Nur der puren Neugier halber: Kann ich gcc mit Optionen so aufrufen, dass es ein Aufruf äquivalent zu g++ ist?

Gruss

Alex
 
Stimmt eigentlich kompiliere ich meine programme sonst auch immer mit g++. Aber kommt trotzdem der Fehleroutput. ich poste mal grad alles:
Code:
Last login: Mon Sep 26 23:06:34 on ttyp2
Welcome to Darwin!
iBook:~ format_c$ g++ HelloWorld.cpp 
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 HelloWorld.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 HelloWorld.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 HelloWorld.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 HelloWorld.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 HelloWorld.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 HelloWorld.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 HelloWorld.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 HelloWorld.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
...
Musste leider den Output kuerzen.
Jemand noch ne Ahnung?
Gruss Alex
 
Bist Du sicher, dass die DevTools bei Dir richtig installiert sind?

Bei mir (10.4) funktioniert es mit g++ 4.0 und 3.3

Gruss

Alex
 
Naja hab grad nochmal die DevelopmentTools.app aus
/Applications/Installers/XCode Tools/Packages/ installiert. Aber das selbe Ergebnis.

MMh och menno.]

Gruss Alex
 
Da fehlt irgendwas.

Wo hast du denn die Development-Tools da her die du installierst? kopfkratz

Installier mal die XCode-Tools von deiner OSX CD. Am besten die Standardinstallation.
 
Bei mir gehts !

Code:
#include <iostream>

using namespace std;

int main() {
        cout << "Hello World\n";
        return 0;
}

kompiliert über : g++ Test.cc -o Test
Ausführen : ./Test

Ausgabe :

Wer glaubt es :D Hello World
 
Jetzt gehts. hab alle XCode Tools installiert. War der meinung einige Komponenten davon wuerden genuegen. Danke allen nochmal fuer die schnellen Antworten.

Gruss Alex
 
Zurück
Oben Unten