Page 1 of 1

visual studio and sdl?

Posted: Sun Feb 22, 2009 4:10 am
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:

Re: visual studio and sdl?

Posted: Sun Feb 22, 2009 8:40 am
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 ;)

Re: visual studio and sdl?

Posted: Sun Feb 22, 2009 12:25 pm
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.

Re: visual studio and sdl?

Posted: Sun Feb 22, 2009 4:13 pm
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...

Re: visual studio and sdl?

Posted: Sun Feb 22, 2009 4:21 pm
by Joeyotrevor
Are you building as Release?

Re: visual studio and sdl?

Posted: Mon Feb 23, 2009 3:29 pm
by PixelP
Joeyotrevor wrote:Are you building as Release?
yeah, i did.

Re: visual studio and sdl?

Posted: Mon Feb 23, 2009 5:31 pm
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.

Re: visual studio and sdl?

Posted: Mon Feb 23, 2009 5:35 pm
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.

Re: visual studio and sdl?

Posted: Tue Feb 24, 2009 7:35 am
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.