I'm using Code::Blocks with MinGW to write my C++ applications in Windows XP.
Now I want to compile my code to run under an MS DOS environment, so I can put it on my DOS formatted floppy disc. Can anyone help me?
Thanks in advance.
P.S. I don't mean the Command Prompt, but really the good old MS DOS Operating System.
It's pretty old, but DJGPP exists precisely for DOS development. I hasn't been updated since 2000, but it works.
It's basically the same as MinGW, but exclusively for DOS.
What year was this written??? (Says four months ago.) Uh, no, DJGPP is still supported, it has G++ 4.4.1 (or unofficial 4.4.2, even)!! The libc itself is still being (very slowly) tweaked, but even 2.03p2 "stable" is from 2002 and 2.04 "beta" from 2003. Where did you get year 2000 and GCC 2.96 (never supported by DJGPP, 2.96 wasn't even an official FSF release, it was a Red Hat fork) from????
I have a setup for developing MSDOS programs from Windows 10 (or whatever Windows you want basically), using the Code::Blocks IDE, and the Open Watcom v2 or Digital Mars C/C++ compilers. Code::Blocks has support for these compilers built into it, but the settings will need a bit of tweaking to get it to build correctly for DOS.
OpenWatcomv2
Open Watcom is the easiest to setup with Code::Blocks. Basically, install Open Watcom following the installation instructions on it's site. Then open Code::Blocks and open "settings"->"compiler" select the "Open Watcom (W32) Compiler", go to "toolchain executables" and direct it to the correct executables and directories of Open Watcom.
C/C++ compiler: wcl.exe
Dynamic libs: wlink.exe
Static libs: wlib.exe
Resource compiler: wrc.exe
Make program: wmake.exe
In the "additional paths", make sure you put
"[OpenWatcomDir]/binnt"
"[OpenWatcomDir]/binnt64"
...assuming you want to use the 64 bit version, see installation instructions otherwise
Also, you will need to go to the "Compiler Options" tab, and right click->modify the option "compile and link for DOS" under the "Executable type options section". You need to add "system dos" in the "linker flags" box, then hit "OK."
I believe this is all you need to do in order to start building DOS programs. Just setup a project with the desired compiler options (memory model and such) and you are good to go. You will need an emulator of some kind to test them without booting DOS or something. I recommend 86Box for testing, as it is a very accurate emulator.
I haven't developed for MS-DOS for some decades; but I'd start checking the tools used on Free-DOS. Maybe there's already a gcc package for it.
Related
I am using Eclipse classic 4.2.1 (Juno) on my new mac to develop c/c++ programs. When I create a new project their is a choice of "Toolchains" to use: Cross GCC, MacOSX GCC and XL C/C++ Tool Chain.
Which one should I choose? I also use the mac terminal to run, make and vim the same code sometimes.
Maybe GCC is in common use if your app will run both in mac and windows
I had the same problem on my Mac OS X Luna(eclipse 8.4) but they are the same edition in general. Just goto the Help tab and click on "Install new software..." or anything similar to that. Type this in the big obvious add software link (pretty much just the test input at the top of the new opened window):
http://download.eclipse.org/tools/cdt/releases/juno
if you think juno can handle the newest version, type this in:
http://download.eclipse.org/tools/cdt/releases/8.4
Select every thing and proceed with the download.
You should now be able to create C/C++ projects and source files. I found this to be slightly buggy, like sometimes not include the standard C++ library, or std does not even exist but this should work if you install the correct version.
It is very easy on Linux to fire-up vi and write a 100-200 lines of code, compile and see the results: ie. Trying small simple examples of C/C++ code.
On windows however, I like Visual Studio but to use it you have create a new solution then a project which then creates a new folder, generates very large PDB and caching files and a small example of 100-200 LOC becomes a 20Mb large project(?!) after compilation.
So the question is how do you write this kind of small codes on Windows? Possibly Cygwin or Dev-C++ (which is not active since 2004?).
You can compile from the command line using cl.exe. See the MSDN article How to: Compile a Native C++ Program from the Command Line for detailed instructions.
When you installed Visual Studio it created an entry in your programs named something like "Visual Studio Command Prompt" (maybe in a group "Visual Studio Tools").
Execute that Command Prompt (it sets up some environment variables needed for the command line compiler) and use cl, the command line compiler.
> cl /?
Copyright (C) Microsoft Corporation. All rights reserved.
C/C++ COMPILER OPTIONS
-OPTIMIZATION-
/O1 minimize space /O2 maximize speed
/Ob<n> inline expansion (default n=0) /Od disable optimizations (default)
/Og enable global optimization /Oi[-] enable intrinsic functions
...
Edit -- copy from another answer :)
Microsoft Documentation: VS2005, VS2008
For the simplest examples codepad may be an option.
I think there's nothing wrong with firing up Visual Studio for some testing. You can delete the 20MB afterwards ;)
However, you can also just invoke the command line compiler on Windows. Just start a Windows SDK console (or Visual Studio console) and you're there. And you can even use vi (need to install it first, of course).
I always use MinGW (GCC for windows) for such tasks.
MinGW is a good solution if you're not using anything Visual Studio specific. If you are, in the start menu with Visual Studio, there should be a script that starts a "commandline" for visual studio.
Also, please keep in mind, even if you aren't going to use Visual Studio, if you use MinGW, you're going to run into issues even with things you might not expect (like...if you decide to try the Apple Bonjour SDK, in which case you're going to get nasty link errors) because GCC and MSVC++ libraries don't always play nice.
And if you don't have access to your local computer, or you are to lazy to look for command line compiler you can paste your code to on-line compiler. There are several of them on the net you can try one of them here. It's free, no registration needed. It has some flaws but for quick code check it's just fine.
You can also use some other languages, C, C++, D, Haskell, Lua, OCaml, PHP, Perl, Python, Ruby, Scheme, Tcl to be precise.
Maybe I'm just a *nix geek, but I went on over to http://consoletelnet.sourceforge.net/gccwin32.html and got gcc for win32. I then headed over to http://unxutils.sourceforge.net/ and go these command line tools. (I renamed their find.exe to gfind.exe to avoid conflict with windows find). I then use gvim for win32 to write code and make/gcc to compile it. Now I only have to learn one environment.
For small bits of code I want to test, such as code that I'm going to include in an SO answer, I always use the command line. My tools on Windows are:
the MSYS tools, particularly their bash shell
the vim editor
the MinGW GCC compiler (Twilight Dragon branch)
I haven't used any of them, but MinGW and lcc-win32 seem to be pretty lightweight, and people seem to like them in news:comp.lang.c. MinGW is a port of GNU Compiler Collection for Windows and is free, lcc-win32 is free for non-commercial use.
You can do the exact same thing for Windows -- fire up VI and run the output through gcc.
Either get MingGW/MSys, Cygwin, or native ports of each app (gnu tools, vi)
Just because you're using Windows, doesn't mean you're forced to use Visual Studio.
I've got a Visual Studio test project with a main file I just overwrite every time I want to test something new. The couple of MB taken up by the .ncb file really really really doesn't matter. A bigger issues is the need to create a project. But I get around that by reusing an old test project.
For small/simple C or C++ source codes I use Ideone. It supports over 40 programming languages.
I usually edit my code within notepad++ then compile it with gcc under cygwin or msys.
I have used Dev-C++ post 2004, and it still works quite well.
I even used projects coded in Dev-C++ for my practicals that had to run on machines using Linux. Just changed the make files.
I also use Visual Studio; for quick testing and prototyping, I have a file scratch.c on my desktop, which I just load up and test things out in.
I don't see opening Visual Studio, clicking the new document icon, writing code, pressing F5 then just accepting the defaults for everything as being too much effort :)
The other alternative I have (which I don't use for C, but do for Haskell) is to PuTTY into a Linux box I have access to, and do everything on there.
I have a Test.sln which has a Test.vcproj which has a Test.cpp. The solution has a few handy configurations (for maximum C++ std conformance and others). I just paste code into/from the Test.cpp file and compile it that way.
I use cl.exe and nmake.exe from Visual C++ Express to compile small groups of .c and .cpp files. Rolling your own simple Makefile for nmake.exe is easy.
Hello I am putting together a tool chain on my windows Box for Cross Platform C++ Development. I plan on using Boost.Build for building and Boost::Test for unit testing. I will be using Mercurial for my VCS because I can just throw the repo on my external HD and then pull it to either my windows or linux partition. The main thing standing in my way is editor compiler/debugger. Anyone have any suggestions?
With Boost.Build I can technically build with whatever compilers it supports easily. That means MSVC on windows and GCC on linux by using the same script with a flag.
Qt Creator using MinGW on Windows and the GNU compiler on Linux. That's what I use and it works perfectly well. Note that you don't have to use Qt when developing with Qt Creator.
May I suggest CMake on Windows and Linux as you can generate native Visual Studio projects as well as Eclipse CDT projects and plain-old makefiles.
If you are targeting multiple platforms, but find yourself primarily developing on a single platform, I highly recommend a continuous build/integration system to ensure a check-in for one platform does not break the build on the others.
Code::Blocks is a free, open source, cross platform C++ IDE. It supports the MS and GCC compilers, among others.
The main thing standing in my way is
editor compiler/debugger. Anyone have
any suggestions?
Yes: Qt Creator as one download and install will satisfy your three requests -- pick the 'LGPL' license route and download and install the SDK which even installs gcc, g++, ... for you. The integrated debugger is very good, and you get cross-platform behavior from both your code and your tools.
you can use gcc/g++ on windows as well. as for debuggers: gdb and ddd might be in cygwin. editor: vim (beware: it's really a programmable editor, not an IDE).
Vim, gdb, gcc/g++, makefile - you can use them on both - Windows and Unix :)
Yet another vote for Code Blocks or Qt Creator.
There are commercial tools too: beside Visual Studio there are MagicC++ (IDE), debuggers like TotalView, Allinea, Zero-bugs, UndoDB ... if you want to stay with VStudio check these VSBridge and WinGDB.
Anyway you can always use MSVC on Windows and other tools on Unix (gdb/DDD for debugging, vim/emacs for edition) - I've worked in this way a lot of years. Common environment for all platforms is nice, but sometimes it is very hard (almost impossible) to "force" it in company (especially big-company) ;-)
Do I really need Visual studio to build c/C++ application on Windows.
Is there any way to have makefiles and get the application built.
You can use any compiler that'll target Windows (for example, MinGW, Digital Mars, Comeau or others). All of them can be driven by the command line so you can use your preferred make utility (or other build utility).
That said, Visual Studio is pretty nice (even the free version). And don't forget that it installs the command line compiler tools, so you can drive it from a makefile as well (unfortunately, it won't spit out a makefile for you anymore, but it has it's own command line tools to drive a build based on project settings if you want to jump from IDE to command line builds).
If you want to stick to the Microsoft toolchain but don't want the IDE, you can use cl and link to build from the command line in conjuction with either the MSBUILD system or NMAKE.
If you don't have the compiler it is available free with VC++ Express.
To install the Microsoft compiler without installing an IDE download the Windows SDK which is available for free.
http://en.wikipedia.org/wiki/Windows_SDK
Qt is very nice, and downloading and installing the SDK gets you the QtCreator which provides a consistent IDE across platforms, with very nice builtin help, build system, access to revision control, debugging, ... and it even includes the MinGW compiler and toolchain for you.
MinGW is something simpler: the usual GNU toolchain but setup such that it provides native Windows binary.
Last but not least, there is Cygwin which gives you the most Unixy flavour.
No, you don't.
I know you said c, but you can also check out MonoDevelop, should you choose to do more than just that: http://monodevelop.com/Download
No you do not. There are many free IDE's out there, or you can do everything from the command line with a non-microsoft compiler.
www.bloodshed.net offers a pretty good IDE that uses the Mingw compiler.
You can even do without extra tools as long as you have the compilers on your machine. Take a look here for an explainatin:
http://msdn.microsoft.com/en-us/library/ms235639.aspx
Not at all. It is quite possible to do Win32 programing, including OS and GUI programming, with gcc from Mingw.
For all my hobby work, if I can I use the gcc compiler from Mingw (for C or Ada), with Emacs as my IDE and gnumake for my build system. There are good Mingw ports for all the major revision control systems too, including Git.
That's the toolset I used to create the SETI#Home Service, which was a wrapper for the SETI#Home client that installed and ran it as a Windows service, did failure detection and auto restarts, and had a built in web server for monitoring. All that with no VisualStudio.
You can use Eclipse with C/C++ Development Toolkit and with Mingw Compilers. the only problem is that you will not have M$ Stuff like MFC, but you can use QT or wxWindows
Two solutions that immediately come to mind:
Cygwin
MinGW
Using makefiles does not prevent you from using the Microsoft C++ compiler, which is nice if you want to use the VS debugger.
How can a cross compilation setup be achieved to allow compiling Cell Linux programs on a Windows PC using the cygwin toolchain? The cygwin tools provide a GNU compiler to use in building the cross compiler, and associated tools for the build process e.g. rpm, cpio, make, flex, bison and so on.
I am moderately confident this is possible, but unaware of anyone who has actually done this. It has already been done for x86 Linux, but I wish to use Windows, without requiring the use and overhead of a virtual machine running an entire 2nd operating system.
The Cell Linux toolchain is a patched GNU toolchain, with C and C++ compilers for the PPU and SPU processors, and associated binutils. The sources for the Cell Linux SDK for Cell Linux can be found here. The source RPMS here have build scripts for use with the rpmbuild tool on Linux.
The specific question is: how can a set of Cell Linux GNU compilers for the PPU and SPU processors be built, on Windows, using Cygwin.
I've never done it, so I can't give you step by step instructions, but I can give you a general idea.
The instructions you linked will serve as a pretty good outline, but there will be definite changes.
For the host PC, you can install gcc and other build tools from MinGW or cygwin. That will give you the windows native parts of your toolchain.
Then you'll need to download the sources for the cell portions of the toolchain and compile them (with the appropriate options, --target, etc.) using the build environment you just installed.
Then you download and compile the sources for libspe2, and you're done.
But I'll warn you - it sounds easier than it is. Be prepared to spend a lot of time on it.
Since you can already do this on Linux x86, why don't you just install Linux a virtual machine? Also, what might be even easier, is to install Portable Ubuntu for Windows. It runs Linux alongside Windows using coLinux. Although this may not be optimal, it is probably much easier than trying to compile everything on Windows.
the ps2dev toolchain can easily be set up under cygwin
http://ps2dev.org/ps3/Tools/Toolchain
You should be able to build a canadian cross compiler on Linux that runs on windows and creates code for PS3. Have a look at the excellent crosstools from Dan Kegel.
Did you check if the Cell/PS3 devtools for windows/cygwin work for you?
A set of tools compiled to run on Windows via Cygwin can now be found on Sourceforge.
Mike Acton has a long, detailed article on cross-compiling for PS3 Linux on his Cell Performance blog.
It may be a bit out of date, but the bits on setting up the toolchain and various SDKs might prove handy.