Reply 20 of 53, by emendelson
Replied by private message. Thank you!
Replied by private message. Thank you!
wrote:That's extremely helpful. Thank you. I got zlib.lib installed correctly, with your help. I'm still working on libpng.lib. But this was exactly what I needed. Thank you again.
Glad it worked, hope Tearex's source works for you, in any case, the principles enumerated on my previous post work in every case: find the folder with the headers, the one with the .lib and add them where they should be.
Thanks again for that. @TeaRex's source compiled on the first try (I use the free 2010 Express Edition, not 2008), and I've been experimenting with small mods ever since.
Very grateful for the help I've had from this group, both in the forums and in PMs.
You're welcome.
tearex
One more question for the generous experts on this forum.
When I compile DOSBOX.EXE in Visual C++ 2010 Express, the resulting .EXE file runs perfectly on most systems, but on some systems it gives an error message about the missing file MSVCP100.DLL. I can run the .EXE on those systems by installing the Redistributable package for Visual C++ 2010, but I want to build an executable that other users can run without installing additional software. If I simply add MSVCP100.DLL and MSVCR100.DLL (also required) to the same directory with DOSBOX.EXE I get an entry-point error.
So I would like to build an .EXE that includes these DLLs, if possible. I've tried various changes to the project properties, but haven't found anything that works. Can anyone tell me the solution (if there is one)?
Thank you.
wrote:When I compile DOSBOX.EXE in Visual C++ 2010 Express, the resulting .EXE file runs perfectly on most systems, but on some systems it gives an error message about the missing file MSVCP100.DLL. I can run the .EXE on those systems by installing the Redistributable package for Visual C++ 2010, but I want to build an executable that other users can run without installing additional software. If I simply add MSVCP100.DLL and MSVCR100.DLL (also required) to the same directory with DOSBOX.EXE I get an entry-point error.
So I would like to build an .EXE that includes these DLLs, if possible. I've tried various changes to the project properties, but haven't found anything that works. Can anyone tell me the solution (if there is one)?
Thank you.
From the 13th post or so in this very same thread:
"In VC++ 2010 express: project properties -> C/C++ -> Code Generation -> Runtime Library : Multi-Threaded (/MT)
as opposed to the original option set for Multi-Threaded DLL (/MD)
You'll still need to distribute the other libraries, though."
wrote:In VC++ 2010 express: project properties -> C/C++ -> Code Generation -> Runtime Library : Multi-Threaded (/MT)
as opposed to the original option set for Multi-Threaded DLL (/MD)
You'll still need to distribute the other libraries, though."
Yes, I saw and tried that. (I should have said that I had already tried that.) Unfortunately, with my original attempt, and with @TeaRex's system, it produces an error when it tries to link sdl.dll.
Why post the same thing thrice?
I'd ask Tearex then, but sounds odd...you have the build configuration set to release instead of debug, right? Also, there are four options to set in runtime library, make sure it's set to Multi-threaded and not Multi-threaded debug.
Also, you probably did this already, but since you don't explain the nature of the error, in linker -> Input -> Ignore specific default libraries you should add to the empty box msvcrt.lib, otherwise it won't compile.
Also, if using TeaRex's source, make sure the include and library directories point to where you are keeping them...specifically the SDL ones (and maybe SDL_net), the rest, from what I gather, are compiled when building the project (basically zlib and libpng?), TeaRex would know...after all he set up that particular Ms-VC "solution".
Sorry about the triple-post - I thought I was editing my first post, but hit the wrong button, and I don't seem to have privileges that would let me delete my own posts.
Thank you for the detailed suggestions. I hadn't set the properties to ignore msvcrt.dll, but I had done everything else you suggested. I won't waste any more of other people's time on this, but will continue to experiment and will report back if I have any success. Thanks again for the patient help.
No idea what exactly you are doing, but IF you're doing a full compile including
compiling the additional libraries, assure that they all have the same setting for the
runtime library (non-DLL choice for static linkage). Otherwise you'll get link errors
for duplicate names.
If it doesn't work please post at least the error message(s).
Thanks for the offer of help.
I'm starting with @TeaRex's setup; I've made minor changes to the icons, text, etc.; all work perfectly with @TeaRex's settings.
If I simply make the change "In VC++ 2010 express: project properties -> C/C++ -> Code Generation -> Runtime Library : Multi-Threaded (/MT)", then I get this error message:
sdlmain.obj : error LNK2001: unresolved external symbol __environ
1>.\Release/DOSBox.exe : fatal error LNK1120: 1 unresolved externals
If I add the sdl and sdl_net include and lib directories to the VC++ directories (under include and libraries), then I still get the same error.
If I then follow this advice: "linker -> Input -> Ignore specific default libraries you should add to the empty box msvcrt.lib" then I get a long list of error messages starting with:
>dosbox.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
1>libcpmt.lib(xthrow.obj) : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
It really may not be worth anyone's time to try to help a beginner through this, but if there's something obvious that I've missed, I'll be grateful.
(Incidentally, I assume that I have to put the msvcp100.dll and msvcr100.dll files somewhere, but my experiments with that failed also, and I won't waste anyone's time with that.)
The visual C++ runtimes were put for you there when you installed Visual C++...so no need to mess with them, if you need to distribute them, there's a handy installer available in Ms' website.
SDL and SDL_net are two different things, if you want to support IPX and modem emulations you need SDL_net if not, don't worry about it, but the SDL include and lib folders MUST be present, no matter what.
Remove mscvcrt.lib from the ignore list in link section if it gives you more errors.
The error message is just what it says, a function call that is used is not found and it should be, so, you're missing a library dependency, or the compiler is not finding a required source file...are you compiling SDL into DosBox? (I don't know, since I don't have TeaRex's project).
If you're sure that you're not building SDL into DosBox and that you have the correct paths pointed to your sdl headers and libs (those MUST be compiled, if they're not already), the only other thing I can think of right now is to make sure sdl.lib and sdlmain.lib are listed in the additional dependencies under linker -> input.
That's all I can think of...ask Tearex how he manages it, if all these fails 😀, otherwise if the build's just for you well...you already have the runtimes...so, why worry?
Thank you again for that. I tried all these things, but couldn't get /MT to work correctly, unfortunately. (SDL etc are compiled, and the correct directories are listed.)
I don't really need to do this, because the distribution version works well enough, but I'm trying to put together a special-purpose DOSBox setup that will run from a USB stick on systems where I (or other users of the setup) may not have administrative privileges, and can't install the redistributable libraries. I'm putting together a custom build with special prompts, icons, keymappings, and (I hope) with some things left out that aren't necessary for this purpose (like sdl_net).
I'll continue to try learning this, and may bother @TeaRex for more help, but only after I've done some more struggling. Just because the people on this board are generous with their time doesn't mean that they've got infinite time to spare.
SDL etc are compiled
If you mean you're using precompiled libraries (from the SDL homepage for example)
then that may not work. As I've already posted just compile all libraries yourself with
the same runtime library setting. To keep things simple disable screenshot and all serial/net
supporting libraries in config.h so only sdl is required.
As wd said, I'd start by disabling everything in config.h that you don't absolutely need. Then see if it works. If not, you'll need to recompile SDL from source as well; it seems that my description of the tree I sent you was wrong (blame my failing memory...), in that I currently don't compile SDL from source any more (I did at some point in the past, but there were some other problems with that which I currently fail to remember).
Note to self: Maybe I should be keeping more notes... but probably I'll forget THAT as well. 😉
tearex
Thank you, @TeaRex. I compiled SDL from source; the resulting file was identical to the one that's already compiled in the project that you sent me. I'm not sure what I need to do next.
In config.h I turned off the FPU, screenshots, all network features. It compiles perfectly as /MD, but not as /MT.
I'm not sure whether this is worth anyone's time, but I'm probably not the only person who would like to figure out how to do this...
the resulting file was identical
What is "the" resulting file? Binary file compare of which file? The library certainly should be different.
In config.h I turned off the FPU
Leave that on, doesn't affect libraries.
It compiles perfectly as /MD, but not as /MT.
"does not" is quite unspecific.
why can't you just include sdl.dll. Having only one exe doesn't add anything.
Water flows down the stream
How to ask questions the smart way!
He wants to statically link the vs2008/20010 runtime library. SDL could indeed be dynamically
linked but has to be linked the same runtime library style as dosbox.
Yes, the point of this is to create a custom build that can be used from a USB stick. If I create a build with Visual C++ 2010, and try to use it on (for example) a 64-bit Windows 7 system, it complains that the redistributables haven't been installed - and they can't be installed if I'm a guest user on the other system.
I tried building with MinGW, but the instructions I found on the wiki were written for people who are more expert than I am, and I wasn't able to get any usable results.