+ 1
Can anybody use SDL?
Hi all. Followibg on from the last question, I have dumped the course. I feel I have learnt lot more through this app and on YouTube! Thank you. I am back to SDL issues now though. I have finally got a working setup but now I have Syntax errors and I cannot see why. It specifically does not like SDL_Surface and SDL_Texture. Any ideas would be appreciated. Thank you.
20 Respuestas
0
Thanks for replying.
Yes, that bit is fine, but on compilation I get a syntax error saying "missing ; before *". There are also two other errors. I will give you more details when I am home.
+ 5
try the tutorials at http://lazyfoo.net/tutorials/SDL/
+ 5
I would start a new project and get sdl working with the hello world example first. Then start pulling code over from the cave story. Is cave story your code? or from the course?
+ 4
Just checking You did copy the dll to the source folder right. also it will need a copy in the debug directory (where the resulting exe from compilation resides)
Otherwise no.. it does not sound an easy fix. It should be quite simple as
*Download sdl-devel from https://www.libsdl.org/download-2.0.php
*extract files.
*create a new project
*configure your ide - includes/libraries/dependancies
*copy required dlls to your projects directory.
thats it.
+ 4
link to vid i will look
+ 4
https://youtu.be/ETvApbD5xRo
is this it?
+ 3
Are you declaring them correctly? They have to be pointers. Ex. SDL_Texture* texture, not SDL_Texture texture
+ 3
^^ @aklex: so true.
+ 3
looks like sdl is not setup correctly
follow the instructions at lazyfoo for your compiler.
+ 3
well SDL_Surface and SDL_Texture being undeclared identifiers says to me not setup correctly. As these are globals if you have included #include <sdl.h>
Even missing a tiny step will cause it not to be setup correctly
+ 3
You will need two copies (one in with main, another with exe) unless you put sdl in your system32/wow64 folder. anyway..
re: SDL_image. you will need to setup this also in your ide (include/lib dirs and dependancy options) and copy the relevant .lib/.dll files to your working directory as they differ from the main sdl setup.
+ 2
If you could provide the relevant source code it would be helpful :p
+ 2
Aaarggghhhh!!
So I have put the dll files into the debug folders and the SDL Trainer is working fine. Howevwr, I am still getting the same errors on the CaveStory and there is no difference in the settings. I just don't get it at all.
I am tempted to totally delete all this Cave Story stuff and start it again. Is there any way I can use the SDL project as a template as I know this one definitely works.?
+ 2
yes. it was fine until episode 4
https://youtu.be/yq_00MAp0Xw
+ 1
Sorry. Couldn't get on my computer yesterday.
Here are the problems:
graphics.flip;
generates the following error:
Graphics::flip : Non standard syntax; use & to crwate a pointer to member.
The Graphics::flip is as follows:
SDL_RenderPresent(this -> renderer);
SDL_Surface * loadimage(const std::string &filepath);
generates the following three errors:
syntax error: missing ; before *
missing type specifier. int assumed. c++ does nit support default int.
unexpected token preceding ;
void blitsurface(SDL_Texture * source, SDL_Rect* SourceRectangle, SDL_Rect* DestinationRectangle);
generates the following error:
Syntax Error: identifier SDL_Texture
std::map<std::string, SDL_Surface*> Spritesheet;
generates the following errors
SDL_Surface: undeclared identifier
syntax error >
std::map: too few template arguments.
+ 1
Hi Jay. i have actually set up all those links correctly. I am going to go through the tutorial on LazyFoo and see if I can work out the problem.
Thanks.
+ 1
Hi Jay. I am absolutely infuriated here!!
The SDL Trainer on LazyFoo has the links set uo exactly the same (I have done a side by side comparison on the screen) and compiles with no errors.
However, even though it compiles, it will not run!! I get an application error, even when I delete all the code so I just have:
int main()
{
return 0;
}
However, removing SDL.H from my includes solves the problem, so looks like the error is in that somewhere. Does this sound like an easy fix?
+ 1
I don't have one in the debug directory. I have it in the same folder as my main.cpp. Is that the wrong place? I also have it in my System 32 folder in to Windows directory.
The wierd thing is, it was working fine on the first programme (The Cave Story on Youtube) so I have actually drawn a window. once I added SDL_image, it all went wrong.
0
it's from the YouTube links that somebody gave me in a previous answer. It's a type along with a programmer sort of thing.
I added the CaveStory code into a copy of the SDL Training and ran it, and I am getting the same 8 errors, which makes me think it is a problem with the coding, not the SDL settings.
0
Hi Jay. Did you get chance to look at this? Is the error in the code?
Thank you.