The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
errors in project using SDL (Lode's Computer Graphics Tutori
barracude


Joined: 22 Jan 2015
Posts: 3
I installed SDL in Codeblocks but I have problem to make the project working because there are some errors

All project files are here: http://lodev.org/cgtutor/
Now the errors are in file: quickcg.cpp
downloadable here
http://lodev.org/cgtutor/files/quickcg/quickcg.cpp
Code:
      
    scr = SDL_SetVideoMode(width, height, colorDepth, SDL_SWSURFACE | SDL_FULLSCREEN);
   


quickcg.cpp||In function 'void QuickCG::screen(int, int, bool, const string&)'Neutral
quickcg.cpp|115|error: 'SDL_FULLSCREEN' was not declared in this scope|

there are more errors like that one.

The other ones:
Code:
    if ((event.key.keysym.unicode & 0xFF80) == 0)

quickcg.cpp|1033|error: 'SDL_Keysym' has no member named 'unicode'|

Warnings:
Code:
    void setBitOfReversedStream(size_t& bitp, unsigned char* bits, unsigned long bit) { bits[bitp >> 3] |=  (bit << (7 - bitp & 0x7)); bitp++; }
quickcg.cpp|1033|error: 'SDL_Keysym' has no member named 'unicode'|


Code:
    else if(colorType == 3) if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8            )) return 37;
warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses]|

What causes the errors? Any suggestion how to correct the errors?

Full build log:

-------------- Clean: Debug in FT (compiler: GNU GCC Compiler)---------------

Cleaned "FT - Debug"

-------------- Build: Debug in FT (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -fexceptions -g -IP:\PROGRAMY\programming\SDL-2.0.3-lib-MinGW\include -IP:\PROGRAMY\programming\SDL-2.0.3-lib-MinGW\include -c "R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\fourier1d.cpp" -o obj\Debug\fourier1d.o
mingw32-g++.exe -Wall -fexceptions -g -IP:\PROGRAMY\programming\SDL-2.0.3-lib-MinGW\include -IP:\PROGRAMY\programming\SDL-2.0.3-lib-MinGW\include -c "R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\fourier2d.cpp" -o obj\Debug\fourier2d.o
mingw32-g++.exe -Wall -fexceptions -g -IP:\PROGRAMY\programming\SDL-2.0.3-lib-MinGW\include -IP:\PROGRAMY\programming\SDL-2.0.3-lib-MinGW\include -c "R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\main.cpp" -o obj\Debug\main.o
mingw32-g++.exe -Wall -fexceptions -g -IP:\PROGRAMY\programming\SDL-2.0.3-lib-MinGW\include -IP:\PROGRAMY\programming\SDL-2.0.3-lib-MinGW\include -c "R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp" -o obj\Debug\quickcg.o
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp: In function 'void QuickCG::screen(int, int, bool, const string&)':
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp:115:71: error: 'SDL_FULLSCREEN' was not declared in this scope
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp:115:85: error: 'SDL_SetVideoMode' was not declared in this scope
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp:120:55: error: 'SDL_HWSURFACE' was not declared in this scope
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp:120:71: error: 'SDL_HWPALETTE' was not declared in this scope
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp:120:84: error: 'SDL_SetVideoMode' was not declared in this scope
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp:128:39: error: 'SDL_WM_SetCaption' was not declared in this scope
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp:130:22: error: 'SDL_EnableUNICODE' was not declared in this scope
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp: In function 'void QuickCG::redraw()':
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp:152:33: error: 'SDL_UpdateRect' was not declared in this scope
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp: In function 'void QuickCG::waitFrame(double, double)':
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp:254:34: error: 'SDL_GetKeyState' was not declared in this scope
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp: In function 'void QuickCG::readKeys()':
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp:285:32: error: 'SDL_GetKeyState' was not declared in this scope
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp: In function 'Uint8 QuickCG::getInputCharacter()':
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp:1033:25: error: 'SDL_Keysym' has no member named 'unicode'
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp:1037:32: error: 'SDL_Keysym' has no member named 'unicode'
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp: In static member function 'static long unsigned int QuickCG::decodePNG(std::vector<unsigned char>&, long unsigned int&, long unsigned int&, const unsigned char*, long unsigned int)::PNG::readBitFromReversedStream(size_t&, const unsigned char*)':
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp:1573:150: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp: In member function 'void QuickCG::decodePNG(std::vector<unsigned char>&, long unsigned int&, long unsigned int&, const unsigned char*, long unsigned int)::PNG::setBitOfReversedStream(size_t&, unsigned char*, long unsigned int)':
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp:1580:129: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp: In member function 'int QuickCG::decodePNG(std::vector<unsigned char>&, long unsigned int&, long unsigned int&, const unsigned char*, long unsigned int)::PNG::checkColorValidity(long unsigned int, long unsigned int)':
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp:1586:14: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses]
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp:1585:14: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses]
R:\PROGRAMS\C++\Fourier Transform\FT-codeblocks\quickcg.cpp:1584:9: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses]
Process terminated with status 1 (0 minute(s), 1 second(s))
12 error(s), 5 warning(s) (0 minute(s), 1 second(s))
barracude


Joined: 22 Jan 2015
Posts: 3
I tried the project first with SDL 2-2.0.3 (actual log) and then with SDL 1.2.15 (the logs seems to be same).
barracude


Joined: 22 Jan 2015
Posts: 3
I found solution. I found that the project does not support version SDL 2.0 but the 1.2.15 and also I needed to correct path for the compiler to include/SDL. Now works.