Dark Bit Factory & Gravity

PROGRAMMING => C / C++ /C# => Topic started by: Clyde on October 10, 2009

Title: [C++] People Can't Run My Exe's
Post by: Clyde on October 10, 2009
Hi,

Have a problem, with either multithreaded dll, or multilthreaded, other people can't run my executables. Apparently they get configuration errors. And I dont know what to do about fixing it.

Thanks,
Clyde.
Title: Re: [C++] People Can't Run My Exe's
Post by: efecto on October 10, 2009
Depends what you're doing offcourse.

using any 3th party libraries that need installing?

microsoft visual C++ 2005 redistributables?

Title: Re: [C++] People Can't Run My Exe's
Post by: zawran on October 10, 2009
Quote
Apparently they get configuration errors.

Which errors, what is the message on the errors?
Title: Re: [C++] People Can't Run My Exe's
Post by: Clyde on October 10, 2009
Im not exactly sure mate, as I've not recieved these myself when I run the exe's on my PC.

I do know that I get a cpu.obj link warning, no matter what I do with using tinyptc.

And im just compiling a program without any external dlls.

Cheers and baffled by science,
Clyde.
Title: Re: [C++] People Can't Run My Exe's
Post by: Jim on October 10, 2009
Any time you use multithreaded dll then those people will need to have the latest visual C runtime dlls installed.  That's why I've been trying to get you to use multithreaded instead.

Jim
Title: Re: [C++] People Can't Run My Exe's
Post by: Clyde on October 10, 2009
Dude, i am using Multithreaded now. But they still can't get zem working.

<edit> Just thought, all custom includes - for example #include gfx_2d.cpp" "gfx_2d.h" "tinyptc_ext.h" these need to be re-built in multithreaded too right?

Cheers for your help, patience and time,
Clyde.
Title: Re: [C++] People Can't Run My Exe's
Post by: Jim on October 10, 2009
No.  They're just source code.

You'll need to find out exactly what the error message is and tell us, or post a not-working exe up to the forum.

Jim
Title: Re: [C++] People Can't Run My Exe's
Post by: va!n on October 11, 2009
@Clyde:
hi, any chance to d/l the exe for testing and taking a small look into the exe to see which dll's it need?
Title: Re: [C++] People Can't Run My Exe's
Post by: Clyde on October 11, 2009
The funny thing is I tried to run this on my Mums pc, which doesnt have any programming related stuff on and it worked. However other people I've sent this to are witnessing the following:

Quote from: Application Error
This application failed to start because the application configuration is incorrect. Reinstalling the application may fix the problem.

@Vain: Yeah sure, im very much hoping that it doesnt need any dll's; freebasic and blitz didnt require extra dll's
Title: Re: [C++] People Can't Run My Exe's
Post by: va!n on October 11, 2009
Seems the exe require following dll:
MSVCR90.dll

Btw, here it works... but still runs to fast...
Title: Re: [C++] People Can't Run My Exe's
Post by: rain_storm on October 11, 2009
Just out of interest are you generating a manifest file? for some weird reason MSVS express 2008 produces exes that don't work on my computer unless I generate the manifest file. This problem is something to do with the linker cos crinkled apps work with or without a manifest file.
Title: Re: [C++] People Can't Run My Exe's
Post by: va!n on October 11, 2009
Continue...

as far as i see, you are using following functions / stuff from the MSVCR90.dll

_amsg_exit
_getmainargs
_cexit
_XcptFilter
_initenv
_initterm
_initterm_e
_configthreadlocale
_setusermatherr
_adjust_fdiv
__p__commode
__p__fmode
_encode_pointer
__set_app_type
__dllonexit
_lock
_onexit
_decode_pointer
_except_handler4_common
_invoke_watson
_controlfp_s
_crt_debugger_hook


Code: [Select]
Your manifest:

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
      </requestedPrivileges>
    </security>
  </trustInfo>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
</assembly>
Title: Re: [C++] People Can't Run My Exe's
Post by: Clyde on October 11, 2009
@Rain Storm: Yep, im generating manifests, what they are I dont quite know.
@Va!n: thanks, i was hoping that I could keep it as a single executable. doesnt sound like thats possible in C++. However doesnt explain how it works on my parents PC. which doesnt have any VC stuff on.
Title: Re: [C++] People Can't Run My Exe's
Post by: va!n on October 11, 2009
Just check if the dll is available on your parents pc... if so, possible any program that has been installed in the past, has still installed the dll too... (if you find the dll on your parents pc, just copy it to your pc and try if the exe works)...

Btw, afaik you can create executables with dynamic and static linked stuff...  maybe this helps:
http://msdn.microsoft.com/en-us/library/abx4dbyh%28VS.80%29.aspx (http://msdn.microsoft.com/en-us/library/abx4dbyh%28VS.80%29.aspx)
Title: Re: [C++] People Can't Run My Exe's
Post by: Jim on October 11, 2009
Quote
i was hoping that I could keep it as a single executable. doesnt sound like thats possible in C++.
Of course it is possible.  For whatever reason though, your project is generating a reference to the C runtime dlls.

Jim
Title: Re: [C++] People Can't Run My Exe's
Post by: Clyde on October 11, 2009
Ah ok, I thought there was. Perhaps its a simple solution like something in either the linker or project settings; again I wouldnt know what that was.
Title: Re: [C++] People Can't Run My Exe's
Post by: Jim on October 11, 2009
Yes, if you've already set 'multithreaded' instead of 'multithreaded dll', it could be to do with one of the libtinyptc_ext or libmmx libs needs the dll version.  In which case there's nothing you can do except beg Rbz to change it.  I'm pretty sure he was able to remove all C runtime stuff from libptc, but maybe not in the version you're using.

Jim
Title: Re: [C++] People Can't Run My Exe's
Post by: va!n on October 11, 2009
@Clyde:
just one idea i come up... what about linking the original needed dll into the original exe? I know their are some tools available to merge a lot files like  exe + images + sound + DLLs to just one executeable. Personally i have never tried this but its just an idea.
Title: Re: [C++] People Can't Run My Exe's
Post by: Clyde on October 11, 2009
Thanks all, really appreciate your help and suggestions :)

I've put in a request to mighty rbz. As an exe of 14kb has now grossed 75kb, and thats an experiment without using any gfx or sonix.

Cheers and have a good one,
Clyde.
Title: Re: [C++] People Can't Run My Exe's
Post by: Jim on October 11, 2009
That will happen if you use multithreaded - the code that was in the dll is linked directly to the application avoiding the need for the dlls to be on the users' computers but makes your exe bigger.  To make smaller applications you have to use fewer C runtime library calls - ideally none at all - the fewer you use the smaller the amount of code that needs to be linked in.

I'm amazed at how much trouble it has been to get you up and running.  Without the ptc problems you'd have been miles ahead by now.  I don't think anyone has really tried it before.  I mostly use my own routines.

By the way, your problems have a well known name - it's called DLL Hell (http://www.google.com/search?q=dll+hell).

Jim
Title: Re: [C++] People Can't Run My Exe's
Post by: Rbz on October 12, 2009
Wow, it seems that I'm the big villain here!  :o

And no, tinyptc_ext doesn't require crt runtime, I'm sure that Clyde have a wrong vcproj config, because every C example I've posted here works fine without extra dll's.

I've attached again one example for you, just build your intro using it.

It's a bit hacked, I agree, due to the use of a renamed "MSVCRT.LIB" (MSVCRTS.LIB) library that came from MSVC6.0, which uses the default  "msvcrt.dll" present on all windows config, it's my way to make smaller exe's and worked fine so far, and also useful for crinkled programs.

Title: Re: [C++] People Can't Run My Exe's
Post by: Jim on October 12, 2009
I don't think you're a villain at all :)
It is a bit odd to set nodefaultlibs=true and then manually to link the crt lib - is that what you're doing?

Jim
Title: Re: [C++] People Can't Run My Exe's
Post by: Clyde on October 12, 2009
@Jim: Now im underway thanks to you good folks, will now be getting thinking caps on for lots of stuff. And am checking out dll hell ;)

@rbz: Sorry dude, didnt mean to come across that way mate. Thanks for the example, am checking it out now. And I wouldnt know what setting(s) I have wrong in my project.

<edit> Found this so far, and that's:
configuration properties->c++->optimization->

favour size or speed: Favor Small Code (/Os)
Title: Re: [C++] People Can't Run My Exe's
Post by: rain_storm on October 12, 2009
Favour Small code is excellent on express 2008 I've gone through disassemblies and have never seen any other compiler work so hard to keep the code small.

I had a nightmare getting into C++ as well. It may appear to veteran C programmers as though its simple but when you come from a basic background there is a lot that you didn't have to worry about before. I would download example source code, try to compile, why doesn't this source code compile? Not a notion of the fact that I had to link a required lib.
Title: Re: [C++] People Can't Run My Exe's
Post by: Clyde on October 12, 2009
Exactly dude! :)

For the time being, I'll have to be content with the fact proggies work for others.

I'd like a tutorial if possible on how to setup a project, so it doesnt produce fat exe's; as im buggered if i can find the way to exclude those other files.
Title: Re: [C++] People Can't Run My Exe's
Post by: Rbz on October 12, 2009
...
It is a bit odd to set nodefaultlibs=true and then manually to link the crt lib - is that what you're doing?
...
Yes, that way we can by pass all crt startup code and only import necessary functions from msvcrt.dll making smaller executables.

..., so it doesnt produce fat exe's; as im buggered if i can find the way to exclude those other files.
The vcproj config above are specially tuned for small executables, it's almost the same config that 4k intro coders have.
Title: Re: [C++] People Can't Run My Exe's
Post by: Clyde on October 12, 2009
Thanks heaps rbz, I owe you another pint.

Is there an option or something to copy over those settings to a new project in the IDE? Plus could you list whats changed from the default settings

Cheers,
Clyde.
Title: Re: [C++] People Can't Run My Exe's
Post by: Clyde on October 14, 2009
And finally wicked with a capital W!!

I wrote down all the settings for C++ and the linker and manually changed my projects ones with the new ones.

This leads to thinking about creating a template if thats possible in the express versions?

Cheers to you all,
Clyde.
Title: Re: [C++] People Can't Run My Exe's
Post by: rain_storm on October 14, 2009
Good stuff :D