Author Topic: Compiling SDL  (Read 10857 times)

Offline Gamegoofs2

  • Multiple posting newcomer
  • *
  • Posts: 11
Compiling SDL
« on: November 28, 2009, 03:20:08 pm »
I just started trying to use SDL. I add all the files to the right folders and did the below quote:
Unfortunately, the Code::Blocks SDL wizard hasn't been updated since SDL changed its include file layout. Not your fault. To get by this, temporarily copy SDL.h up a level (from "SDL" to "include"). This is just to get the wizard to finish; you should then get rid of the copy and adjust any #include <SDL.h> to #include <SDL/SDL.h>.
I got the wizard to make the project but when I go to compile the sample code that Code Blocks supplies it says this:

Quote
It seems this project has not yet been built. Do you want to build it?
I said yes, but get this in the build log:
Quote
-------------- Build: Debug in SDL ---------------

Linking console executable: bin\Debug\SDL.exe
C:\Program Files\CodeBlocks\MinGW\bin\ld.exe: cannot open output file bin\Debug\SDL.exe: Permission denied
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

I'm sure there is an easy fix and I just don't know it. Thanks for you help.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Compiling SDL
« Reply #1 on: November 28, 2009, 04:31:13 pm »
Patch for the wizard; not tested for a few months.

Tim S.


Code
Index: src/plugins/scriptedwizard/resources/sdl/wizard.script
===================================================================
--- src/plugins/scriptedwizard/resources/sdl/wizard.script (revision 5680)
+++ src/plugins/scriptedwizard/resources/sdl/wizard.script (working copy)
@@ -47,8 +47,15 @@
         local dir_nomacro_inc = GetCompilerIncludeDir(dir, SDLPathDefault, SDLPathDefaultInc);
         if (dir_nomacro_inc.IsEmpty())
             return false;
-        if (!VerifyFile(dir_nomacro_inc, _T("SDL.h"), _T("SDL's include")))
-            return false;
+           
+        if (!IO.FileExists(dir_nomacro_inc + wxFILE_SEP_PATH + _T("SDL.h")))
+        {
+            if (VerifyFile(dir_nomacro_inc, _T("SDL/SDL.h"), _T("SDL's include")))
+                SDLPathDefaultInc = SDLPathDefaultInc + _T("/SDL");
+            else
+                return false;
+        }
+       
 
         // verify library dependencies
         local dir_nomacro_lib = GetCompilerLibDir(dir, SDLPathDefault, SDLPathDefaultLib);
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Gamegoofs2

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Compiling SDL
« Reply #2 on: November 28, 2009, 04:43:11 pm »
The problem isn't with the wizard though. It's when I go to compile the code.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Compiling SDL
« Reply #3 on: November 28, 2009, 04:45:51 pm »
Turn on Full Compiler Log.
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

Check if EXE was created; if yes try running from command line.

If Vista or Windows 7, turn off security.
And, run Code::Blocks as Admin.

« Last Edit: November 28, 2009, 04:47:47 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Gamegoofs2

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Compiling SDL
« Reply #4 on: November 28, 2009, 05:36:52 pm »
Here's what full command line gives:
Quote
-------------- Build: Debug in SDL ---------------

mingw32-g++.exe -L"C:\Program Files\CodeBlocks\MinGW\lib"  -o bin\Debug\SDL.exe obj\Debug\main.o    -lmingw32 -lSDLmain -lSDL.dll -luser32 -lgdi32 -lwinmm -ldxguid
C:\Program Files\CodeBlocks\MinGW\bin\ld.exe: cannot open output file bin\Debug\SDL.exe: Permission denied
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

When I check for the EXE I can't even see the project file. What's up with that?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Compiling SDL
« Reply #5 on: November 28, 2009, 05:40:12 pm »
Here's what full command line gives:
Quote
-------------- Build: Debug in SDL ---------------

mingw32-g++.exe -L"C:\Program Files\CodeBlocks\MinGW\lib"  -o bin\Debug\SDL.exe obj\Debug\main.o    -lmingw32 -lSDLmain -lSDL.dll -luser32 -lgdi32 -lwinmm -ldxguid
C:\Program Files\CodeBlocks\MinGW\bin\ld.exe: cannot open output file bin\Debug\SDL.exe: Permission denied
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

When I check for the EXE I can't even see the project file. What's up with that?

Do you have read/write permissions on the folder.
What OS?
Why do you NOT try using MinGW in a path with OUT spaces or special characters
What Code::Blocks version/SVN?
What MinGW GCC version?

Tim S.
« Last Edit: November 28, 2009, 05:42:06 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Gamegoofs2

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Compiling SDL
« Reply #6 on: November 28, 2009, 06:29:40 pm »
I just installed Code Blocks under C:/Codeblocks and now it seems to work.

How would I go about updating that SDL wizard now?