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:

Post by piku »

kel wrote: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.
That's what I'm already doing, which is rather puzzling.

Does installing the Runtime DLLs that I packaged up in a previous post make mine work for anyone?
return (0);
User avatar
kel
Baaaaaa!
Baaaaaa!
Posts: 2461
Joined: Thu Oct 02, 2003 1:29 pm 0
Location: england

Post by kel »

Have you updated your project since you uploaded, as the one on your site its set to Multi-threaded DLL (/MD) rather than (/MT).

FWIW, I just complied Nehe lesson5 with no problems, setting (/MT) does double the size of the exe though, from the Nehe complied 32KB to the express complied 64KB but it also removes the need for MSVCR80.dll according to Dependency Walker.
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 »

Ahh what you're doing is statically linking everything into your .exe file.

This is generally considered a bad thing to do. It also isn't "compatable" with the SDL licence since I have to allow you lot to use a different sdl.dll if you want.

Trying it with my code gives lots of errors about things being defined more than once.
return (0);
User avatar
kel
Baaaaaa!
Baaaaaa!
Posts: 2461
Joined: Thu Oct 02, 2003 1:29 pm 0
Location: england

Post by kel »

Ahh, right, as I said I had no idea what it did anyway :D

So the only way to get rid of the runtime dependencies for SDL stuff is to buy a proper version of VC++ then?

If so, fucksticks, I knew there'd be a catch with Express somewhere.
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:Ahh, right, as I said I had no idea what it did anyway :D

So the only way to get rid of the runtime dependencies for SDL stuff is to buy a proper version of VC++ then?

If so, fucksticks, I knew there'd be a catch with Express somewhere.
I think, if you install the runtime stuff using that installer I created, it'll all be OK...
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 »

Yep, my cousin just installed the runtime stuff I made an installer for, then both my particle thing and the test exes worked fine.

So it would seem the express edition requires the runtime dlls, doesn't tell you this, and doesn't give a meaningful error when it can't find them.

This windows coding sure is fun! All these little bugs and strange errors to overcome just to make your code work.
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 »

kel wrote:If so, fucksticks, I knew there'd be a catch with Express somewhere.
Nothing to do with express. Same thing would happen with any recent version of VS. You can't expect your code to work if code it's calling isn't there, can you? ;)
Nothing is worth the effort you put into it.
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:
kel wrote:If so, fucksticks, I knew there'd be a catch with Express somewhere.
Nothing to do with express. Same thing would happen with any recent version of VS. You can't expect your code to work if code it's calling isn't there, can you? ;)
Quite. Be nice if the Express Edition had an InstallShield wizard or similar in it. It was nice in VC++6 being able to generate a setup file and associated files by pressing a few buttons.

It does all make complete sense if you think about it... only in every other development environment I've not needed to do this, so haven't thought about it.
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 »

piku wrote:It was nice in VC++6 being able to generate a setup file and associated files by pressing a few buttons.
You can do that? Where are these buttons you speak of?
Nothing is worth the effort you put into it.
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:
piku wrote:It was nice in VC++6 being able to generate a setup file and associated files by pressing a few buttons.
You can do that? Where are these buttons you speak of?
Under the Tools menu of the version I had, there was an option called "Installshield wizard" or something. It came free with a cut-down version of Installshield which only worked with Visual Studio projects.

I had the Enterprise Edition (or whatever the version is called that comes on six CDs along with MSDN) of it though, so maybe it's not in any other version.
return (0);
StepFather
Baa!
Baa!
Posts: 47
Joined: Sun Oct 30, 2005 5:57 pm 0
Location: SPACE

Post by StepFather »

I do not have the Visual C++ Express installed, but I do own Visual Studio .NET 2003 and Visual Studio 2005 BETA 2. I was unable to even open your project file in Visual Studio 2003 .NET because (as expected) the new Visual C++ Express requires a newer compiler (v8.0) compared to what .NET 2003 has (v7.0). I was able to open the project and compile using Visual Studio 2005 BETA 2, although I did get "some" errors as SDL is missing some files on my system as I no longer use it.
User avatar
kel
Baaaaaa!
Baaaaaa!
Posts: 2461
Joined: Thu Oct 02, 2003 1:29 pm 0
Location: england

Post by kel »

Snakey wrote:
kel wrote:If so, fucksticks, I knew there'd be a catch with Express somewhere.
Nothing to do with express. Same thing would happen with any recent version of VS. You can't expect your code to work if code it's calling isn't there, can you? ;)
Oh I see, I guess this will be a none issue for people who have .NET or are running vista then?

Btw, piku, what does that installer you created install, is it the merge modules or the actual dlls?

[edit] its got to be the dlls init :mong: :D
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: Btw, piku, what does that installer you created install, is it the merge modules or the actual dlls?

[edit] its got to be the dlls init :mong: :D
It installs some magic... part of this magic is the DLLs, but the whole package is what the merge-module is, isn't it? The MSDN makes this bit rather confusing.

The Wix toolkit I use is quite cool though, you can make "normal" installers with it too. And it's OpenSource... from Microsoft, which is quite an interesting notion!
return (0);
User avatar
Mr Dom
Baaaaa!
Baaaaa!
Posts: 1375
Joined: Fri Dec 03, 2004 3:03 pm 0
Location: Cardiff

Post by Mr Dom »

So the only way to get rid of the runtime dependencies for SDL stuff is to buy a proper version of VC++ then?
/MT /MD flags are standard in any VC version from 6 up
They only refer to the run time library functions to link to (new, delete, sprintf, etc.) so changing this flag shouldnt effect SDL at all.
From experience I would avoid the DLL versions of the runtime like the plague, and use only Single or Multi threaded as required (tho MFC requires the DLL version I seem to recall). If you link to a DLL runtime you need some version of msvcrt.dll. Looks like the express VC uses a slightly different one to .NET which is slightly odd.

All in all, use MT, dont bother packing the msvcrt.dll in, and just build with the /MT flag. In old VC it is:
Project/Settings/Code Generation - use run time library/Multithreaded.
You should make sure this is set the same over all dependencies & rebuild all, then you can pass you're exe's around happily from express.
- Dom
Play Games
<Haircuts are for wimps!>
User avatar
kel
Baaaaaa!
Baaaaaa!
Posts: 2461
Joined: Thu Oct 02, 2003 1:29 pm 0
Location: england

Post by kel »

Mr Dom wrote: All in all, use MT, dont bother packing the msvcrt.dll in, and just build with the /MT flag.
Ahh, cheers for explaining that.

As piku mentioned above though, if I set the /MT flag I get a load of errors like this:

Code: Select all

Generating Code...
Linking...
msvcrt.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
msvcrt.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
msvcrt.lib(MSVCR80.dll) : error LNK2005: _exit already defined in LIBCMT.lib(crt0dat.obj)
msvcrt.lib(MSVCR80.dll) : error LNK2005: _strrchr already defined in LIBCMT.lib(strrchr.obj)
msvcrt.lib(MSVCR80.dll) : error LNK2005: _fgetc already defined in LIBCMT.lib(fgetc.obj)
msvcrt.lib(MSVCR80.dll) : error LNK2005: _fclose already defined in LIBCMT.lib(fclose.obj)
msvcrt.lib(MSVCR80.dll) : error LNK2005: _setvbuf already defined in LIBCMT.lib(setvbuf.obj)
msvcrt.lib(MSVCR80.dll) : error LNK2005: __isctype already defined in LIBCMT.lib(isctype.obj)
LIBCMT.lib(crt0init.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
C:\Documents and Settings\blah\.exe : fatal error LNK1169: one or more multiply defined symbols found
I've played around with setting /NODEFAULTLIB and excluding certain libs, but I just get more errors as I haven't got a clue what I should or shouldn't be excluding, any suggestions?
Post Reply