Code: Select all
#pragma once
#include <SDL/SDL.h>
#include <string>
class System {
public:
SDL_Surface *screen;
System();
bool init(string title, int width, int height, bool full);
};
Code: Select all
#include "System.h"
#include <string>
System::System() {
screen = NULL;
}
bool System::init(string title, int width, int height, bool full) {
if(SDL_Init(SDL_INIT_EVERYTHING) == -1) {
return false;
}
if(full) {
screen = SDL_SetVideoMode(width, height, 32, SDL_FULLSCREEN);
} else {
screen = SDL_SetVideoMode(width, height, 32, SDL_SWSURFACE);
}
if(screen == NULL) {
return false;
}
SDL_WM_SetCaption(title.c_str(), NULL);
return true;
}
Code: Select all
/Users/jacobgarber/Desktop/SDL/System.h:11: error: 'string' has not been declared
/Users/jacobgarber/Desktop/SDL/System.cpp:8: error: 'bool System::init' is not a static member of 'class System'
/Users/jacobgarber/Desktop/SDL/System.cpp:8: error: 'string' was not declared in this scope
/Users/jacobgarber/Desktop/SDL/System.cpp:8: error: expected primary-expression before 'int'
/Users/jacobgarber/Desktop/SDL/System.cpp:8: error: expected primary-expression before 'int'
/Users/jacobgarber/Desktop/SDL/System.cpp:8: error: expected primary-expression before 'bool'
/Users/jacobgarber/Desktop/SDL/System.cpp:8: error: initializer expression list treated as compound expression
/Users/jacobgarber/Desktop/SDL/System.cpp:8: error: expected ',' or ';' before '{' token
cd /Users/jacobgarber/Desktop/SDL
/Developer/usr/bin/gcc-4.0 -x c++ -arch ppc -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wunused-variable -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mfix-and-continue -mtune=G5 -fvisibility-inlines-hidden -mmacosx-version-min=10.4 -gdwarf-2 -I/Users/jacobgarber/Desktop/SDL/build/SDL.build/Debug/SDL.build/SDL.hmap -F/Users/jacobgarber/Desktop/SDL/build/Debug -F/Users/jacobgarber/Library/Frameworks -F/Developer/SDKs/MacOSX10.4u.sdk/Library/Frameworks -I/Users/jacobgarber/Desktop/SDL/build/Debug/include -I/Users/jacobgarber/Library/Frameworks/SDL.framework/Headers -I/Developer/SDKs/MacOSX10.4u.sdk/Library/Frameworks/SDL.framework/Headers -I/Users/jacobgarber/Desktop/SDL/build/SDL.build/Debug/SDL.build/DerivedSources/ppc -I/Users/jacobgarber/Desktop/SDL/build/SDL.build/Debug/SDL.build/DerivedSources -include /var/folders/RI/RIxlp3ksGAWi66A-rj783E+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/SDL_Prefix-cgyewiqdyuzibvgjrihvkhvfkuez/SDL_Prefix.pch -c /Users/jacobgarber/Desktop/SDL/System.cpp -o /Users/jacobgarber/Desktop/SDL/build/SDL.build/Debug/SDL.build/Objects-normal/ppc/System.o
/Users/jacobgarber/Desktop/SDL/System.h:11: error: 'string' has not been declared
/Users/jacobgarber/Desktop/SDL/System.cpp:8: error: 'bool System::init' is not a static member of 'class System'
/Users/jacobgarber/Desktop/SDL/System.cpp:8: error: 'string' was not declared in this scope
/Users/jacobgarber/Desktop/SDL/System.cpp:8: error: expected primary-expression before 'int'
/Users/jacobgarber/Desktop/SDL/System.cpp:8: error: expected primary-expression before 'int'
/Users/jacobgarber/Desktop/SDL/System.cpp:8: error: expected primary-expression before 'bool'
/Users/jacobgarber/Desktop/SDL/System.cpp:8: error: initializer expression list treated as compound expression
/Users/jacobgarber/Desktop/SDL/System.cpp:8: error: expected ',' or ';' before '{' token
/Users/jacobgarber/Desktop/SDL/System.h:11: error: 'string' has not been declared
/Users/jacobgarber/Desktop/SDL/System.cpp:8: error: 'bool System::init' is not a static member of 'class System'
/Users/jacobgarber/Desktop/SDL/System.cpp:8: error: 'string' was not declared in this scope
/Users/jacobgarber/Desktop/SDL/System.cpp:8: error: expected primary-expression before 'int'
/Users/jacobgarber/Desktop/SDL/System.cpp:8: error: expected primary-expression before 'int'
/Users/jacobgarber/Desktop/SDL/System.cpp:8: error: expected primary-expression before 'bool'
/Users/jacobgarber/Desktop/SDL/System.cpp:8: error: initializer expression list treated as compound expression
/Users/jacobgarber/Desktop/SDL/System.cpp:8: error: expected ',' or ';' before '{' token