Making Visual C++ Express code work (was whirly particles)

Coders forum. Discuss techniques, swap code snippets, ask for help etc. relating to all forms of software development.
User avatar
piku
Sheepie Whore
Sheepie Whore
Posts: 20960
Joined: Wed Apr 24, 2002 10:44 am 0
Website: Http://Www.ncot.uk
Location: Wakefield
Contact:

Making Visual C++ Express code work (was whirly particles)

Post by piku »

This has now turned into a thread about making Visual C++ Express 2005 work without having to install it on every one else's machine

Although downloading and playing with my whirly particle thing is still a good idea ;)



Had a bit of a fiddle with some particle code I created earlier this week. After spending aaaages decyphering Visual Studio's weird compiler warnings I have some fancy code that runs on Linux and Windows.

If you're a Linux user, there's the standard Configure stuff (and a KDevelop project if you use that). If you're a Windows user there's a Visual Studio project.

Windows users will find a precompiled executable in the 'Release' Directory. Linux users...

Code: Select all

./configure
make
then find the 'particles' binary and run it.

Controls

Move the mouse
Press the a and b buttons...
Do both at the same time, do either randomly...

Requirements
Windows or Linux
SDL
OpenGL

Download

Get it from here... My Website.

I may expand this into something else, or take my code and turn it into part of a game. For now it's just for fun, so enjoy and wiggle your mouse :)
Last edited by piku on Sat Dec 24, 2005 2:08 pm 0, edited 1 time in total.
return (0);
User avatar
chris_b
Baaaa!
Baaaa!
Posts: 961
Joined: Sun Dec 12, 2004 2:50 pm 0
Location: UK
Contact:

Post by chris_b »

I tried running "Particles.exe" but got a message: "This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem." (I'm using Windows XP SP2)
User avatar
piku
Sheepie Whore
Sheepie Whore
Posts: 20960
Joined: Wed Apr 24, 2002 10:44 am 0
Website: Http://Www.ncot.uk
Location: Wakefield
Contact:

Post by piku »

chris_b wrote:I tried running "Particles.exe" but got a message: "This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem." (I'm using Windows XP SP2)
Errr... So am I :?

Maybe it's the version of sdl.dll that's wrong...

Hmm... will look at that tomorrow. Working out why I can't play Mario Kart any more is slightly more interesting at the moment ;)

---

Well, it works OK on my machine, which makes testing this a little difficult. Anyone else get it working or not?
return (0);
User avatar
t0ne
Baaaaaa!
Baaaaaa!
Posts: 3134
Joined: Wed Sep 11, 2002 8:48 am 0
Location: Bristol

Post by t0ne »

piku wrote: Well, it works OK on my machine, which makes testing this a little difficult. Anyone else get it working or not?
Same error here. WinXP SP2.
User avatar
piku
Sheepie Whore
Sheepie Whore
Posts: 20960
Joined: Wed Apr 24, 2002 10:44 am 0
Website: Http://Www.ncot.uk
Location: Wakefield
Contact:

Post by piku »

t0ne wrote:
piku wrote: Well, it works OK on my machine, which makes testing this a little difficult. Anyone else get it working or not?
Same error here. WinXP SP2.
Balls...

All I've done is install that free version of Visual C++ 2005 Express Edition, followed the instructions on making SDL work in Windows and then added some slight voodoo to the code which makes the compiler link the libraries correctly.

I also installed the Direct X December 2005 SDK, but I don't use it. This thing uses SDL and OpenGL, nothing special and no weirdo libraries...

So what daft runtime thing do I need to also package up to make this work? There's obviously something installed on my system that makes this work, but is missing from everyone else's.

If someone else with Visual Studio or Visual C++ could try it too, that'd help.
return (0);
User avatar
t0ne
Baaaaaa!
Baaaaaa!
Posts: 3134
Joined: Wed Sep 11, 2002 8:48 am 0
Location: Bristol

Post by t0ne »

'fraid it wouldn't let me open the project in Visual Studio 2003 otherwise I'd have run it through the debugger for you :(
User avatar
piku
Sheepie Whore
Sheepie Whore
Posts: 20960
Joined: Wed Apr 24, 2002 10:44 am 0
Website: Http://Www.ncot.uk
Location: Wakefield
Contact:

Post by piku »

t0ne wrote:'fraid it wouldn't let me open the project in Visual Studio 2003 otherwise I'd have run it through the debugger for you :(
That'll be Visual Studio not being backwards compatable with itself then. Joy.

You could re-create the project file. All it is is a Windows Console application without the MFC or precompiled headers. The #pragma gubbins should make the linker work. You'll also need the SDL development kit from http://www.libsdl.org (http://pgdc.purdue.org/sdltutorial/sdl_setup.html).

It'd better not be a "feature" of the Express edition where you can't run your code on a machine that doesn't have the Express edition installed. That'd really suck.
return (0);
User avatar
Snakey
Baaaaaaa!
Baaaaaaa!
Posts: 8938
Joined: Thu May 09, 2002 4:17 pm 0
Location: Hell on Earth

Post by Snakey »

There's a util that lets you check what stuff an EXE is looking for, can't remember what its called offhand... but I can't even download the ZIP. Gets to 2.8MB and says its finished every time. :?
Nothing is worth the effort you put into it.
User avatar
kel
Baaaaaa!
Baaaaaa!
Posts: 2461
Joined: Thu Oct 02, 2003 1:29 pm 0
Location: england

Post by kel »

It works here, although I have Express installed so it was bound to.

Love to know why it's not working though.

Can someone without Express installed try this, just to see if there are any funky dependencies needed.

Noddy console app that just prints "Working", if it works.
User avatar
piku
Sheepie Whore
Sheepie Whore
Posts: 20960
Joined: Wed Apr 24, 2002 10:44 am 0
Website: Http://Www.ncot.uk
Location: Wakefield
Contact:

Post by piku »

Snakey wrote:There's a util that lets you check what stuff an EXE is looking for, can't remember what its called offhand... but I can't even download the ZIP. Gets to 2.8MB and says its finished every time. :?
That'll be Dependency Walker. Wonder why you can't download the file... nothing special going on there!

According to Dependency Walker, the app needs:

msvcr80.dll
sdl.dll
opengl32.dll
glu32.dll
kernel.dll

And you need DirectX installed.

What's 'efsadu.dll' do? According to Dependency Walker my code needs it, but it's not on my system. Although it still works for me!
return (0);
User avatar
piku
Sheepie Whore
Sheepie Whore
Posts: 20960
Joined: Wed Apr 24, 2002 10:44 am 0
Website: Http://Www.ncot.uk
Location: Wakefield
Contact:

Post by piku »

kel wrote:It works here, although I have Express installed so it was bound to.

Love to know why it's not working though.

Can someone without Express installed try this, just to see if there are any funky dependencies needed.

Noddy console app that just prints "Working", if it works.
I'm on my Dad's laptop at the moment... your code gives the same error as mine...
return (0);
User avatar
piku
Sheepie Whore
Sheepie Whore
Posts: 20960
Joined: Wed Apr 24, 2002 10:44 am 0
Website: Http://Www.ncot.uk
Location: Wakefield
Contact:

Post by piku »

We need to give out the Visual C++ runtime libraries. An hour's running around MSDN with your undies on your head eventually turns this up:

http://blogs.msdn.com/nikolad/archive/2 ... 60368.aspx

Just do it... And watch out that he uses "d:\" in a few places which isn't right...

An installer is attached to this post. Try installing it first then running my code...
Attachments
vccrt.zip
Visual Studio runtime libraries
(1.71 MiB) Downloaded 47 times
Last edited by piku on Sat Dec 24, 2005 2:02 pm 0, edited 1 time in total.
return (0);
User avatar
kel
Baaaaaa!
Baaaaaa!
Posts: 2461
Joined: Thu Oct 02, 2003 1:29 pm 0
Location: england

Post by kel »

piku wrote:I bet it works if you install the .NET 2.0 runtime stuff... all 23 meg of it...
Yeah, that's where msvcr80.dll come from isn't it?

Piku, can you try this version on your dads pc.
User avatar
piku
Sheepie Whore
Sheepie Whore
Posts: 20960
Joined: Wed Apr 24, 2002 10:44 am 0
Website: Http://Www.ncot.uk
Location: Wakefield
Contact:

Post by piku »

kel wrote:
piku wrote:I bet it works if you install the .NET 2.0 runtime stuff... all 23 meg of it...
Yeah, that's where msvcr80.dll come from isn't it?

Piku, can you try this version on your dads pc.
Hey! That works!... what did you do?
return (0);
User avatar
kel
Baaaaaa!
Baaaaaa!
Posts: 2461
Joined: Thu Oct 02, 2003 1:29 pm 0
Location: england

Post by kel »

Goto Project Propertie/Configuration Properties/C/C++/Code Generation – then set Runtime Library to Multi-threaded DLL (/MT)

I have no idea what it does :D

I found it by creating an empty project and noticing the difference in complied sizes to that of a Win32 console application, then just compared the settings.

It bumps up the size of your exe quite a bit though, my prog goes from 8KB to 104KB

Can anyone with a standard version of VC++ do a release compile of the code below just to compare the difference in output size. I dinky program like this shouldn't be 104KB's should it?

Cheers.

Code: Select all

#include <iostream>
using namespace std;

int main () 
{
  cout << "Working" << endl;
  while(true){}
}
Post Reply