Problem when running a SDL compiled with MinWG

Hi everybody,

I hope it’s the best way to ask for answers about SDL, I’ve searched for
about a day now, but without any results.

I currently have a problem using SDL library to make a program running on
Windows. I developed a program in a Linux environment using gcc 4.3 and it
worked fine. I now want to migrate it in a Windows environment. I first
installed Eclipse (the same IDE I’m using under Linux) and then I installed
MinGW to compile my program (C:\MinGW\bin\mingw32-make).

I installed the headers and the SDL.dll library. I used CMake to create my
Makefile and I have made sure that every libraries I need are linked
correctly, i.e.:
mingw32
SDLmain
SDL

I had the WinMain() problem, but it is now solved, my program compiles like
a charm, but it can’t run, nothing happens, even though the SDL.dll is in
the directory in which the .exe is.

So I created a small project to see where the problem was:

That runs fine:

#include
using namespace std;

int main(int argc, char *argv[]){

cout << "Here I am... in a windows environment" << endl;

cout << "End of Windows program" << endl;

return 0;

}

That doesn’t run, but compiles like a charm:

#include

#include “SDL/SDL.h”

using namespace std;

int main(int argc, char *argv[]){

cout << "Here I am... in a windows environment" << endl;

cout << "End of Windows program" << endl;

return 0;

}

It seems, one way or another, the #include “SDL/SDL.h” is messing somewhere,
but I really don’t know what is the problem. Of course, I can’t really go on
with my primary project until I have solved this.
I surely must have missed something, please, don’t be too hard, I’m new at
compiling on Windows and tools like MinGW are new to me.

Thank you for your help,

J?r?me

FWIW, you are supposed to include “SDL.h” not “SDL/SDL.h.” You need to
adjust your preprocessor/compiler’s #include search path to
accommodate this standard. I guess your preprocessor will always
search the directory a file is in from which an #include is being
executed. But that isn’t the problem you’re having, so…

You say it “doesn’t run.” Well, what does that mean exactly? Does it
throw an error? Does it exit without printing the text you expect it
to?

By default SDL on Windows redirects stdout/stderr to files named
$PWD/std{err,out}.txtOn Fri, Feb 6, 2009 at 11:30 AM, J?r?me Guilmette <jerome.guilmette at gmail.com> wrote:

That doesn’t run, but compiles like a charm:

#include
#include “SDL/SDL.h”

using namespace std;

int main(int argc, char *argv[]){

cout << "Here I am... in a windows environment" << endl;

cout << "End of Windows program" << endl;

return 0;

}


http://codebad.com/

Yesh sorry for the #include “SDL/SDL.h”, I didn’t set any compiling options
redirecting to that folder located in MinGW/include/SDL…

By default SDL on Windows redirects stdout/stderr to files named
$PWD/std{err,out}.txt

I should have known before, perhaps I didn’t see it in the doc or I was way
too much concentrated on my issues, but I see the text I expected to see in
that file and my main project works, with errors, bubt at leats I can see
what is wrong! So it means that everything works, thank you Donny and sorry
to have bothered you all !

2009/2/6 Donny Viszneki <donny.viszneki at gmail.com>> On Fri, Feb 6, 2009 at 11:30 AM, J?r?me Guilmette <jerome.guilmette at gmail.com> wrote:

That doesn’t run, but compiles like a charm:

#include
#include “SDL/SDL.h”

using namespace std;

int main(int argc, char *argv[]){

cout << "Here I am... in a windows environment" << endl;

cout << "End of Windows program" << endl;

return 0;

}

FWIW, you are supposed to include “SDL.h” not “SDL/SDL.h.” You need to
adjust your preprocessor/compiler’s #include search path to
accommodate this standard. I guess your preprocessor will always
search the directory a file is in from which an #include is being
executed. But that isn’t the problem you’re having, so…

You say it “doesn’t run.” Well, what does that mean exactly? Does it
throw an error? Does it exit without printing the text you expect it
to?

By default SDL on Windows redirects stdout/stderr to files named
$PWD/std{err,out}.txt


http://codebad.com/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

If you temporarily need to see what’s being spit out, but aren’t
interested in getting SDL to directs its stdio streams elsewhere, use
tail -f std{err,out}.txt while the program runs (make sure the files
exist before you do that though)On Fri, Feb 6, 2009 at 12:08 PM, J?r?me Guilmette <jerome.guilmette at gmail.com> wrote:

By default SDL on Windows redirects stdout/stderr to files named
$PWD/std{err,out}.txt


http://codebad.com/