Namespace von Code::Blocks nicht erkannt
-
Hey Leute,
Ich hab n kleines problem mit code::blocks. Ich hab gerade versucht eine SFML Datei zu erstellen allerdings erkennt das Programm den Befehl(?) namespace nicht und die Fehlermeldungen würde ich sagen stimmen einfach nicht. Die Fehlermeldungen sagen aus dassnamespace sf{}
nicht erkannt wird und danach kein ; gefunden wird ich habe dann umgeschrieben auf
namespace sf;{}
nun wird der ; noch immer nicht erkannt...
Dies kommt insgesamt 3* im Programm vor und die 7. Fehlermeldung ist das:#include<ostream> int main(){window.display}
hier wird folgende Fehlermeldung ausgegeben: E:\OneDrive\...32 fatal error: ostream: No such file or directory
Hoffe irgendjemand hat eine Ahnung was hier falsch gelaufen ist danke für alle antworten
-
Zeig mal bitte den kompletten Code deiner main.cpp.
-
Hier die main:
#include <SFML/Graphics.hpp> int main() { // create the window sf::RenderWindow window(sf::VideoMode(800, 600), "My window"); // run the program as long as the window is open while (window.isOpen()) { // check all the window's events that were triggered since the last iteration of the loop sf::Event event; while (window.pollEvent(event)) { // "close requested" event: we close the window if (event.type == sf::Event::Closed) window.close(); } // clear the window with black color window.clear(sf::Color::Black); // draw everything here... // window.draw(...); // end the current frame window.display(); } return 0; }
und hier die Config.hpp:
#ifndef SFML_CONFIG_HPP #define SFML_CONFIG_HPP //////////////////////////////////////////////////////////// // Define the SFML version //////////////////////////////////////////////////////////// #define SFML_VERSION_MAJOR 2 #define SFML_VERSION_MINOR 3 #define SFML_VERSION_PATCH 2 //////////////////////////////////////////////////////////// // Identify the operating system // see http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system //////////////////////////////////////////////////////////// #if defined(_WIN32) // Windows #define SFML_SYSTEM_WINDOWS #ifndef NOMINMAX #define NOMINMAX #endif #elif defined(__APPLE__) && defined(__MACH__) // Apple platform, see which one it is #include "TargetConditionals.h" #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR // iOS #define SFML_SYSTEM_IOS #elif TARGET_OS_MAC // MacOS #define SFML_SYSTEM_MACOS #else // Unsupported Apple system #error This Apple operating system is not supported by SFML library #endif #elif defined(__unix__) // UNIX system, see which one it is #if defined(__ANDROID__) // Android #define SFML_SYSTEM_ANDROID #elif defined(__linux__) // Linux #define SFML_SYSTEM_LINUX #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) // FreeBSD #define SFML_SYSTEM_FREEBSD #else // Unsupported UNIX system #error This UNIX operating system is not supported by SFML library #endif #else // Unsupported system #error This operating system is not supported by SFML library #endif //////////////////////////////////////////////////////////// // Define a portable debug macro //////////////////////////////////////////////////////////// #if !defined(NDEBUG) #define SFML_DEBUG #endif //////////////////////////////////////////////////////////// // Define helpers to create portable import / export macros for each module //////////////////////////////////////////////////////////// #if !defined(SFML_STATIC) #if defined(SFML_SYSTEM_WINDOWS) // Windows compilers need specific (and different) keywords for export and import #define SFML_API_EXPORT __declspec(dllexport) #define SFML_API_IMPORT __declspec(dllimport) // For Visual C++ compilers, we also need to turn off this annoying C4251 warning #ifdef _MSC_VER #pragma warning(disable: 4251) #endif #else // Linux, FreeBSD, Mac OS X #if __GNUC__ >= 4 // GCC 4 has special keywords for showing/hidding symbols, // the same keyword is used for both importing and exporting #define SFML_API_EXPORT __attribute__ ((__visibility__ ("default"))) #define SFML_API_IMPORT __attribute__ ((__visibility__ ("default"))) #else // GCC < 4 has no mechanism to explicitely hide symbols, everything's exported #define SFML_API_EXPORT #define SFML_API_IMPORT #endif #endif #else // Static build doesn't need import/export macros #define SFML_API_EXPORT #define SFML_API_IMPORT #endif //////////////////////////////////////////////////////////// // Define portable fixed-size types //////////////////////////////////////////////////////////// namespace sf { // All "common" platforms use the same size for char, short and int // (basically there are 3 types for 3 sizes, so no other match is possible), // we can use them without doing any kind of check // 8 bits integer types typedef signed char Int8; typedef unsigned char Uint8; // 16 bits integer types typedef signed short Int16; typedef unsigned short Uint16; // 32 bits integer types typedef signed int Int32; typedef unsigned int Uint32; // 64 bits integer types #if defined(_MSC_VER) typedef signed __int64 Int64; typedef unsigned __int64 Uint64; #else typedef signed long long Int64; typedef unsigned long long Uint64; #endif } // namespace sf #endif // SFML_CONFIG_HPP
Das ganze ist von der SFML seite heruntergeladen also dürfte eig. alles stimmen es sollte nur ein test sein aber nichts funktioniert :C
-
Okay jetzt Copy-Paste bitte alle Fehlermeldungen, die entstehen wenn du die main kompilierst.
-
Könnte es sein, daß das Projekt bzw. die Datei als C kompiliert wird (z.B. weil die Endung nur ".c" anstatt ".cpp" lautet oder aber die Projekteinstellung diesbzgl. falsch ist)?
-
Nathan fehler meldungen sind oben also
Namespace wird nicht erkannt
Erwartet =,;,:, etc vor klammern
Kennt Ostream nichtUnd dass es als c complimiert wäre könnte möglich sein allerding habe ich nicht viel hoffnung da ich zwar keine ahnung von c habe aber ich nicht glaube das derartig wenig unterschiede zwischen den sprachen ist
Danke trotzdem
-
Fuchsi1 schrieb:
Nathan fehler meldungen sind oben also
Namespace wird nicht erkannt
Erwartet =,;,:, etc vor klammern
Kennt Ostream nichtUnd als c complimiert wäre könnte möglich sein allerding habe ich nicht viel hoffnung da es ich zwar keine agnung von c habe aber ich nicht glaube das derartig wenig unterschiede zwischen den sprachen sind
Danke trotzdem
Doch, die Fehlermeldung hört sich tatsächlich danach an, C kennt keine namespaces und auch kein Ostream.
Allerdings müsste es dann noch viel mehr Fehlermeldungen geben.