   linux to windows problem, SDL
  I have been working in linux on a SDL program for a while. I have been trying to get a windows version of the program working, but both using visual studio and minGW it will not completely work.the program just frezes and windows closes it after saying it will not resopondmost of the time the program will work fine if I take out certain images. the background image (first thing blit, over whole screen) and the map (blit at 0,0 puts the map up then covers up part of it with squares)rarely it will still not work even if these parts are not active.the memory and cpu usage are fine, and the only warnings I get when compileing are saying I am passing floats as int'sI have never had any similar problem in linux, the only difference between the windows and linux versions are the file paths to the sounds and images   
  Sounds like some debugging is in order. Suggestions:1. Make sure you're checking all SDL-related return values and error codes (e.g. when loading assets, converting images, etc.).2. Use the debugger. If you're getting any run-time error messages, make a note of them. Also, try stepping through the program in the debugger to find out where the program is getting hung up.   ;  when I can I will try to use visual stuido again to compile it but when I did it last I could in fact get the debug version to work fine, after changeing the includes somewhat. the problem was in the release builds, they would freze up, like what is happing now with minGw.when they breaked they went for the end of a funtion that used SDL (the last } in the funtion) when I commenting on out it would go for the next in the loop   ;  hmm for some reason it does not like when I use a stringstream as the text in ttfbut only sometimes...   ;  ok my problem is in my true text font, for some reason lines like thisint experienceX = 32;int experienceY = 645;int xpTextY = 640 + textDownFormat;int experienceXIncrement = 6;int xpTextX = 300;int experienceEndRightBarX = 630;int experienceEndBarX = 0;int i = experience;while (i > 1 )//keeps bliting to show xp bar{blit.ApplySurface( experienceX, experienceY, xpImg, backgroundScreen ); experienceX = experienceX + experienceXIncrement;i = i - 1;}string xpString;xpString = "XP:";xpText = TTF_RenderText_Solid( fontXP, xpString.c_str() , textColor ); <--hereblit.ApplySurface( xpTextX, xpTextY, xpText, backgroundScreen); SDL_FreeSurface( xpText ); ---ApplySurface funtion---void Surface::ApplySurface( int x, int y, SDL_Surface* source, SDL_Surface* destination ){    SDL_Rect offset;    offset.x = x;    offset.y = y;    SDL_BlitSurface( source, NULL, destination, &offset );} in linux and debug mode in visual studio it works fine, but in relese it either stops immidatly when it gets to that line or one like it or goes threat 3 or so frams then stops (except for one line that it will show fine for some reason I cant determine)edit) it seams to work for the first line of text, the next one however crashes it   ;Quote:Original post by Jpikeedit) it seams to work for the first line of text, the next one however crashes itIs that code you posted for the second line of text?You said that it didn't like that you were using stringstream.. I don't see any stringstreams in your code.One thing that might cause your bug is if you had code like this:std::stringstream stream;stream << "abc";TTF_RenderText_Solid(font, stream.str().c_str(), color);;  I do in fact have code exactly like that, how can I change it while mainting my funtionality (for that mater why does that not work?)(on the code I put there I took out the stringstream and put in reguar text in a test, the code listed still did not work, though I have alot of text bliting so I might have missed some)edit) I do not have the std:: but i am in namespace std so that should not mater[Edited by - Jpike on June 26, 2009 2:25:27 PM];  Actually I think I might be wrong about that. I thought it might be bad because stringstream.str() returns a temporary string, and then c_str() gives you a pointer into that temporary object, so you end up passing TTF_RenderText_Solid a pointer into unused memory. But I did a few tests and I couldn't get it to crash that way, so maybe that code isn't a problem.   ;  the thing is that unless I work in relese mode in visual studio it is not a problem, in linux using a g++ command I have never had a problem, nor in visual studio debug mode.so if this is causing a problem (and this solution fits too well, its either something wrong with stringstream or some problem with TTF) do I just need to set a string equal to the stringstream then convert that to a C string when I use it in TTF?   ;Quote:Original post by Jpikeso if this is causing a problem (and this solution fits too well, its either something wrong with stringstream or some problem with TTF) do I just need to set a string equal to the stringstream then convert that to a C string when I use it in TTF?Yeah, pretty much. If that code is a problem, then you can instead to this:std::stringstream stream;// ....std::string result = stream.str();TTF_RenderText_Solid(font, result.c_str(), color);and that should be correct. That way you aren't calling c_str() on a temporary.   