visual studio and sdl?

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
PixelP
Chaos Rift Regular
Chaos Rift Regular
Posts: 153
Joined: Tue Oct 07, 2008 12:23 pm
Programming Language of Choice: c/c++
Location: sweden
Contact:

visual studio and sdl?

Post by PixelP »

ive just got Visual Studio 2008 and im already running into problems. i compiled a sdl program for my friend but he couldnt run it on his computer. the error said: "The application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.". ive been looking around for solutions, but i cant get it to work. i read that you need to set your project to release mode and set the runtime library to Multi-threaded (/MT) or Multi-threaded Debug (/MTd). it work with a simple console program but with sdl im getting errors:

msvcrt.lib(MSVCR90.dll) : error LNK2005: _isspace already defined in LIBCMT.lib(_ctype.obj)
msvcrt.lib(MSVCR90.dll) : error LNK2005: _exit already defined in LIBCMT.lib(crt0dat.obj)
LIBCMT.lib(crt0init.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library

i tried to ignore the specific library MSVCRT, but it gave me new errors:

sdlmain.lib(SDL_win32_main.obj) : error LNK2001: unresolved external symbol __imp__fprintf
sdlmain.lib(SDL_win32_main.obj) : error LNK2001: unresolved external symbol __imp____iob_func
sdlmain.lib(SDL_win32_main.obj) : error LNK2001: unresolved external symbol __imp__fclose
sdlmain.lib(SDL_win32_main.obj) : error LNK2001: unresolved external symbol __imp__strrchr

i read that you need to have Microsoft Visual C++ Redistributable Package installed on your computer to get it working, thats really gay. if that is the only solution im taking my life... so please help me. :worship:
Last edited by PixelP on Tue Feb 24, 2009 7:38 am, edited 1 time in total.
User avatar
KuramaYoko10
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 55
Joined: Fri Oct 31, 2008 8:02 pm

Re: visual studio and sdl?

Post by KuramaYoko10 »

Isnt that probably because the computer have to have the .dll files of SDL in the system?

Try putting it in the system32 folder (if you are using windows) the SDL.dll, and other dlls if needed (SDL_image, etc)...

But I think that the easiest way is to create a setup project, which I think is not available on express editions =/ .... with the setup project it will install all the files that are needed to the program to work!

I have posted a reply here of how I do it:
http://elysianshadows.com/phpBB3/viewto ... art=999999
KuramaYoko10 wrote:- You right click "Solution" in the Solution's Panel, and click add -> New Project
- Look for the "Other Project Types -> Setup & Deployment" , and select Setup Project
- Then you can do several things with this, add a shortcut to the users desktop, decide which files you want to insert in the folder, where to install it, do registry keys and etc... you have to play with it, but the basic is to right click "Application Folder" and select "add -> Project Output"
- Then you just have to build the project again, and the Setup folder will be created inside your projects folder... then you have just to install it using either the setup.exe or setup.msi

Tried to do my best explaining it xD... try it and pm me if you have any questions with it ;)
Type a message here!!
[b][color=#BF0000]MarauderIIC[/color][/b] wrote:"Never" is never true in programming.
User avatar
Joeyotrevor
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 62
Joined: Thu Jan 22, 2009 6:24 pm
Programming Language of Choice: C++

Re: visual studio and sdl?

Post by Joeyotrevor »

In "Project>Properties>Configuration Properties>General" Change "Use of MFC" to "Use MFC in a static library". After doing this you have to tell the compiler about the lib files you are using or else you'll get a bunch of errors, so go to "Project>Properties>Configuration Properties>Linker>Input" and in "Additional Dependencies" add "SDL.lib SDLmain.lib". You might have to add some more depending on what else you are using.

Next, go to "Project>Properties>Configuration Properties>C++>Code Generation" and make sure your application is set to build as Multi-threaded DLL. Once you build again your application should work on any computer.

Code: Select all

eb 0c 48 65 6c 6c 6f 20 77 6f 72 6c 64 21 31 d2 8e c2 30 ff b3 0a bd 02 7c b9 0b 00 b8 00 13 cd 10 eb fe
User avatar
PixelP
Chaos Rift Regular
Chaos Rift Regular
Posts: 153
Joined: Tue Oct 07, 2008 12:23 pm
Programming Language of Choice: c/c++
Location: sweden
Contact:

Re: visual studio and sdl?

Post by PixelP »

@Joeyotrevor
his computer didnt like it :(

@KuramaYoko10
i made an installer and my friend had to run it and then restart his computer to get it working. but i dont know, the amount of downloaders would probably decrease a lot if they need to install plus restart their computer before they can try a little demo. there must be another way...
Last edited by PixelP on Sun Feb 22, 2009 5:32 pm, edited 1 time in total.
User avatar
Joeyotrevor
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 62
Joined: Thu Jan 22, 2009 6:24 pm
Programming Language of Choice: C++

Re: visual studio and sdl?

Post by Joeyotrevor »

Are you building as Release?

Code: Select all

eb 0c 48 65 6c 6c 6f 20 77 6f 72 6c 64 21 31 d2 8e c2 30 ff b3 0a bd 02 7c b9 0b 00 b8 00 13 cd 10 eb fe
User avatar
PixelP
Chaos Rift Regular
Chaos Rift Regular
Posts: 153
Joined: Tue Oct 07, 2008 12:23 pm
Programming Language of Choice: c/c++
Location: sweden
Contact:

Re: visual studio and sdl?

Post by PixelP »

Joeyotrevor wrote:Are you building as Release?
yeah, i did.
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: visual studio and sdl?

Post by avansc »

hey pixel, long time. well im not sure, but i know microsoft has some protective measures when you use their IDE to make programs. ie. you cant run it on a computer that doe sent have VS on it, well not exactly true. but thats the main idea of it. im not sure how te get buy this without compiling it via command prompt. i'll do some research and let you know when i find out.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: visual studio and sdl?

Post by MarauderIIC »

PixelP wrote:@Joeyotrevor
his computer didnt like it :(

@KuramaYoko10
i made an installer and my friend had to run it and then restart his computer to get it working. but i dont know, the amount of downloaders would probably decrease a lot if they need to install plus restart their computer before they can try a little demo. there must be another way...
That's because the installer installs MS's version 9 of the C library, which is the same reason why you can't run a MSVS program out-of-the-box -- they change their c library all the time. You can probably overwrite your msvcrt90.dll (I think that's what it is) with the version that's distributed with Windows, or you can distribute a certain set of files to avoid the installer, I think.

Edit: Try distributing the files from C:\program files\microsoft visual studio 9.0\vc\redist\x86\Microsoft.VC90.CRT
You might have to put them in a Microsoft.VC90.CRT subdir from your main program, I'm not sure.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
PixelP
Chaos Rift Regular
Chaos Rift Regular
Posts: 153
Joined: Tue Oct 07, 2008 12:23 pm
Programming Language of Choice: c/c++
Location: sweden
Contact:

Re: visual studio and sdl?

Post by PixelP »

avansc wrote:hey pixel, long time. well im not sure, but i know microsoft has some protective measures when you use their IDE to make programs. ie. you cant run it on a computer that doe sent have VS on it, well not exactly true. but thats the main idea of it. im not sure how te get buy this without compiling it via command prompt. i'll do some research and let you know when i find out.
thanks.
its good to see you.
avansc wrote:Try distributing the files from C:\program files\microsoft visual studio 9.0\vc\redist\x86\Microsoft.VC90.CRT
You might have to put them in a Microsoft.VC90.CRT subdir from your main program, I'm not sure.
hmm, ive already tried that.
Post Reply