VOGONS


First post, by zeras

User metadata
Rank Newbie
Rank
Newbie

I have downloaded DOSBOX sources and like to compile with MS Visual C++ 2008 Express Edition.

After trying to compile I get few times following message:

1>d:\!daten\c++\dosbox-0.73\include\timer.h(23) : fatal error C1083: Datei (Include) kann nicht geöffnet werden: "SDL.h": No such file or directory

Do I have to load this file somewhere else?
As that I'm not a C expert, I don't know, how to overcome this problem.

Reply 1 of 53, by Kippesoep

User metadata
Rank Oldbie
Rank
Oldbie

You're in luck. Not long ago I wrote an article on the DOSBox wiki that describes every step you need to follow to compile DOSBox with VC++ 2k8 E. Check it out http://www.dosbox.com/wiki/Building_DOSBox_wi … _C_2008_Express

My site: Ramblings on mostly tech stuff.

Reply 2 of 53, by zeras

User metadata
Rank Newbie
Rank
Newbie

S U P E R. I've just got compiled.

Thank you.

But I got one problem. I could not open winres.rc. After clicking right mouse click, I got a message, that it's not allowed to to open/update this file. After that, I have tried to open with normal editor and later on, it was possible to open with Visual C++ as well. Why????

Last edited by zeras on 2009-07-24, 17:34. Edited 1 time in total.

Reply 4 of 53, by Kippesoep

User metadata
Rank Oldbie
Rank
Oldbie

Other than ease of use, there's not much I can think of. The Microsoft compiler is quite good and the Express edition now also includes all the optimisation features so it's definitely not a bad choice.

My site: Ramblings on mostly tech stuff.

Reply 5 of 53, by swaaye

User metadata
Rank l33t++
Rank
l33t++

Kippesoep,

I added a couple of steps to your guide. You forgot to set it to "Release" build mode instead of "Debug" and to turn on the CPU core inlining option.

BTW, setup this way and with the compiler optimizations set as they came for Release, the end binary is almost 1.4MB smaller than the official 0.73 build. That's pretty amazing. The normal CPU core seems quite a bit faster according to a Quake timerefresh but Dynx86 appears unaffected as expected.

Reply 6 of 53, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

the end binary is almost 1.4MB smaller than the official 0.73 build

You're aware that an msvc build will need additional dlls on a computer that
doesn't have msvc installed, aren't you?

Reply 7 of 53, by Kippesoep

User metadata
Rank Oldbie
Rank
Oldbie
swaaye wrote:

I added a couple of steps to your guide. You forgot to set it to "Release" build mode instead of "Debug" and to turn on the CPU core inlining option.

Not switching to Release was intentional. The point of the article is merely getting the project to build with absolute minimal effort. There's very little point in just doing a build with MSVC without, as there's no advantage over using the released version (unless you get the CVS code -- which I don't cover in the article). Debug is useful when you're trying to learn about the workings of DOSBox or changing code. To me the whole point of building it myself is having the debug features.

The CPU core inlining should indeed be enabled for release, but it didn't fit in the "absolute minimal effort" assumption I started from.

swaaye wrote:

BTW, setup this way and with the compiler optimizations set as they came for Release, the end binary is almost 1.4MB smaller than the official 0.73 build. That's pretty amazing. The normal CPU core seems quite a bit faster according to a Quake timerefresh but Dynx86 appears unaffected as expected.

The binary size is no indication, as such a build would not include libpng, sdl_net and the crt, all of which are statically built into the official version.

Reply 9 of 53, by swaaye

User metadata
Rank l33t++
Rank
l33t++

I did build it once in debug mode with curses, libpng, sdl_net, and zlib. It was still smaller than the official GCC build. Though yeah I did forget about other Windows libraries that are dynamically linked. And I didn't consider that the official release would have more static stuff built in.

Kipp, I didn't realize that you were after the debug build. I think it caused me problems though. I built it on my main desktop (Win 7 x64) and then tried to use it on one of my notebooks (XP x64 & Win7 x64). It wouldn't run, gave an error about Windows SXS being incorrect. From what I read in the notebook's Win7 event viewer, it sounded like the exe needed some debug libraries (probably installed by Vis C++). The release build doesn't have this issue.

I am a complete noob at Visual C++. I hadn't touched it until two days ago, motivated by the discovery of that Express edition being free and Kipp's guide.

Reply 10 of 53, by emendelson

User metadata
Rank Oldbie
Rank
Oldbie

The wiki guide is terrific. I managed to compile successfully in about ten minutes. Thank you.

One question: for those of us who are using this a way to learn more, could you let us know how to make build that can run on systems without Visual C++ installed?

Thanks again.

Reply 12 of 53, by bloodbat

User metadata
Rank Oldbie
Rank
Oldbie
emendelson wrote:

One question: for those of us who are using this a way to learn more, could you let us know how to make build that can run on systems without Visual C++ installed?
Thanks again.

I assume you mean without having to install the Visual C++ runtimes?
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)
It shouldn't be so dissimilar in VC++ 2008
You'll still need to distribute the other libraries, though.

Reply 13 of 53, by TeaRex

User metadata
Rank Member
Rank
Member

Compiling libpng, zlib etc. statically into the build is quite possible in VC++, it just takes some fiddling. Just copy their own sources into your DOSBox project and build the whole shebang in one go. I build a DOSBox.exe that needs no libraries other than the SDL.dll and SDL_net.dll that come with the official exe. And with all the little optimization options turned on, a VC++ 2010 compiled DOSBox is quite a bit faster than the official release, even when using dynamic core (VC++ 2008, not so much. The Microsoft compiler seems to have improved quite a bit).

tearex

Reply 14 of 53, by emendelson

User metadata
Rank Oldbie
Rank
Oldbie

TeaRex,

Could you possibly provide some details about how you added libpng and zlib to your Visual C++ project? I spent a couple of hours yesterday trying to add these to various places in the VC++ directories in the project, without success. I've got everything else working, but this one I can't seem to solve, and I haven't found any detailed advice elsewhere. I know that other people would also be grateful for any advice if you have time to give it.

Reply 16 of 53, by emendelson

User metadata
Rank Oldbie
Rank
Oldbie

Sorry: I meant that I added the zlib, png, etc. files to the LISTS of directories in the Options settings of the Project itself (in the dialog boxes where you add directories to the existing lists of Include, Libraries, Source Code, etc. directories). I know perfectly well that it isn't enough simply to add them to the file system of the hard disk.

What I'm hoping someone might be willing to explain is exactly where in the VC++ interface I should add exactly which directories that are already on my hard disk, so that I don't get an error message saying that (for example) zlib.lib couldn't be found when I try to build the application.

Bloodbat, if you could possibly provide that information, I and a lot of other people would be grateful, since there are other posts from people who had similar questions.

Reply 17 of 53, by bloodbat

User metadata
Rank Oldbie
Rank
Oldbie

Ok, I'll try to be clear and I hope this helps.
In VC++ 2010 Project properties, there's a section "VC++ Directories."
There's an include directories list, so say, for example, I have zlib developement files in c:\devel\zlib, I add it in that list, why? That's where the header files for zlib are found (zlib.h, for instance), it needs to be done for every project requirement, (for instance, zlib and sdl, among others, for DosBox), now, the lib files are *usually* in a subfolder called "lib" in the libraries' "root" directory, so, for example, my zlib is c:\devel\zlib\dll32 (as you can see there's no "lib" sufolder), in there I find zlib.lib, among other files, so, that directory needs to be added under the "Library directories" list.
You do need to check for the presence of the correct lib files, mostly the folder names are obvious (even if they're not lib).
For example, wxpack includes a lib folder with 4 subfolders:
gcc_dll, gcc_lib, vc_dll and vc_lib, so if I'm compiling with VC++ I'd need to point the "libraries" list to c:\devel\wxwidgets2.8\lib\vc_lib and if I'm using mingw I'd need to point it to c:\devel\wxwidgets2.8\lib\gcc_lib
So, all in all, check for the presence of the correct lib for your compiler.
Again this is for VC++2010, but 2008 isn't that dissimilar.
Now, what TeaRex meant was compiling the libraries from source along with your project to link them statically in it.
Hope this was helpful.