Jump to content

  • Log In with Google      Sign In   
  • Create Account


Code::Blocks "SDL2.dll not found"


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Acharis   Crossbones+   -  Reputation: 3557

Like
0Likes
Like

Posted 31 January 2014 - 06:29 AM

I have a slight configuration problem with Code::Blocks. My old SDL1.2 is configured nicely, it uses dlls from the SDL bin folder. But for some reason I can't configure SDL 2.0 the same way and I need to manually copy dlls to the project folder (I don't want to drop these to the system folder, want to contain this within Code::Block and projects environment).

 

I can't find any difference between my SDL 1.2 and SDL 2.0 configuation, I must be missing something...

I attached a screenshot with all steps I took.

Attached Thumbnails

  • CB-SDL2-config.png

Europe1300.eu - Historical Realistic Medieval Sim (RELEASED!)


Sponsor:

#2 richardurich   Members   -  Reputation: 1187

Like
1Likes
Like

Posted 31 January 2014 - 10:35 AM

Are you sure you didn't have another copy of SDL 1.2's dll in your system folder which is in the system path variable?

 

If you do want to change your working directory though, it should be project->properties->build target->[name]->execution working directory. Execution working directory looks like it's on your last screenshot there.



#3 georger.araujo   Members   -  Reputation: 813

Like
2Likes
Like

Posted 06 February 2014 - 06:57 PM

I have a slight configuration problem with Code::Blocks. My old SDL1.2 is configured nicely, it uses dlls from the SDL bin folder. But for some reason I can't configure SDL 2.0 the same way and I need to manually copy dlls to the project folder (I don't want to drop these to the system folder, want to contain this within Code::Block and projects environment).

 

I can't find any difference between my SDL 1.2 and SDL 2.0 configuation, I must be missing something...

I attached a screenshot with all steps I took.

I've attached an SDL2 project wizard to this reply. Tested on Windows 8 Pro x64 with stock installs of Code::Blocks 13.12, MinGW32 and SDL2 2.0.1 - I suppose it works on Linux as well since sdl2-config is mentioned in the wizard, but I didn't test (look at the edit below).

How to install on Windows:
1) Make a backup copy of C:\Program Files (x86)\CodeBlocks\share\CodeBlocks\templates\wizard\config.script because it will be overwritten.
2) Unzip the attached file to C:\Program Files (x86)\CodeBlocks\share\CodeBlocks\templates
3) Done. Now when creating a new project, the "SDL2 project" template is available.

Details:
1) The template only assumes that stock SDL2 is installed, and only links against SDL2main and SDL2.dll - in other words, if you are using SDL2_image, SDL2_mixer, SDL2_net, or SDL2_ttf, you'll have to manually add those to the Linker settings/Link libraries under Build options.
2) The template includes a post-build step that copies the SDL2 DLLs to the output folder - in other words, you can run the project directly after building. There's no need to copy the DLLs to the output folder nor to any other folder in your PATH. I suppose this solves the problem you reported.

 

EDIT: Just tested it on Code::Blocks 12.11 on Debian Wheezy 32-bit with libsdl2-dev from wheezy-backports, and it worked.

How to install on Debian Wheezy 32-bit (I suppose it's not all that different on other distros):
1) Make a backup copy of /usr/share/codeblocks/templates/wizard/config.script because it will be overwritten.
2) Unzip the attached file to /usr/share/codeblocks/templates
2.5) If you're really picky, convert the line endings of /usr/share/codeblocks/templates/wizard/config.script using e.g. dos2unix
3) Done. Now when creating a new project, the "SDL2 project" template is available.

Attached Files


Edited by georger.araujo, 08 February 2014 - 07:21 PM.


#4 Acharis   Crossbones+   -  Reputation: 3557

Like
0Likes
Like

Posted 07 February 2014 - 11:54 AM


Are you sure you didn't have another copy of SDL 1.2's dll in your system folder which is in the system path variable?

If you do want to change your working directory though, it should be project->properties->build target->[name]->execution working directory. Execution working directory looks like it's on your last screenshot there.
No, It's not that I have SDL.dll installed (the same story is with SDL_TTF and SDL_Mixer I don't need to copy these when running a SDL1.2 project but have to copy them for SDL2 project.

 

The "execution working directory" in my SDL1.2 project is ".", it's the same for SDL2 project.

 

 


2) The template includes a post-build step that copies the SDL2 DLLs to the output folder
Well... you mean it will physically copy all dlls to the project folder after compiling? Not "link them without copying"? I wanted to make it like my SDL1.2 which requires no copying at all.

 

 

Well, it's not a big problem, but still I'm curious, why SDL1.2 and SDL2 setup behave so different...


Europe1300.eu - Historical Realistic Medieval Sim (RELEASED!)


#5 dejaime   Crossbones+   -  Reputation: 4003

Like
0Likes
Like

Posted 07 February 2014 - 01:23 PM

Your SDL exe works without the .dll in either the system nor its directory?

It looks like you are using static linkage on SDL1 and shared on SDL2.

If you were not linking SDL 1 statically, I really don't understand how it could work without the dll in the folder, system or PATH.

 

You can use a loader application, one that handles the path for your dll, or one that actually calls your true executable from, say, a separated bin folder, that has your dll.



#6 Acharis   Crossbones+   -  Reputation: 3557

Like
0Likes
Like

Posted 07 February 2014 - 05:34 PM


Your SDL exe works without the .dll in either the system nor its directory?
Yes. But only if run via Code::Blocks (it seems to be getting these from the directory specified by the global variables). The thing is, I have set the global variables the same way (at least it seems that way to me) for SDL2 and I can't get the same effect....

 


a separated bin folder, that has your dll
With the old SDL 1.2 it gets these from the bin folder of my libraries. With SDL2 I can't make it do it.

 

Again, I'm talking ONLY about Code::Blocks environment. It would be not posible for the final release version.

 

 

Or maybe Code::Blocks have set up PATH for the old SDL1.2? And when I tried to manually add SDL2.0 I missed that step somehow? (althrough I don't know how, even through I used the SDL template I needed to add  TTF and mixer manually, so it should not work for that one...)

It's driving me crazy, the mystery why this setup of SDL 1.2 and 2.0 behaves so different :D


Europe1300.eu - Historical Realistic Medieval Sim (RELEASED!)





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS