Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
The community reviewed whether to reopen this question 8 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I have installed MS-DOS 6.22 on a VirtualBox virtual machine, everything is working well, the purpose of doing that is to compile a program written in the C language that displays and edits bits in the (virtual) RAM. However, I need a way to install a C compiler on the virtual MS-DOS operating system.
Here are a bunch of details others have missed:
Nobody mentioned DJGPP at all.
It's a protected-mode DOS port of GCC and probably has the largest selection of libraries and guides available of any of the open-source options. (Including a Turbo Vision port with an installation HOWTO)
No matter what you're trying to do, OpenWatcom (source) is likely to meet your needs.
OpenWatcom still includes the free license to use DOS/4GW that made it so popular back in the day. (When you see a game like DOOM saying "DOS/4GW Protected Mode Runtime" when it starts, that means that it was built using Watcom C/C++, because DOS/4GW is the special Watcom bundle version of DOS/4G.)
In fact, DOS/4GW's creator was trying to dig up the source code for a newer version of DOS/4GW to contribute to Open Watcom when he passed away.
If you don't want nostalgia, OpenWatcom bundles newer, better alternatives to DOS/4GW, like DOS/32 and PMODE/W.
If you want to putter around with Windows 3.1 programming, OpenWatcom includes Win386, a 32-bit extender for Window 3.x which was used by companies like Sierra for their Windows 3.1 games before Microsoft produced their own "Win32s" 32-bit API addon.
OpenWatcom can target all supported platforms from a single install. (I use it to build various DOS and Windows test EXEs from Linux.)
OpenWatcom can target a lot of retro-platforms:
COM files
real-mode EXEs (there's a separate set of options to select minimum CPU requirement)
protected-mode EXEs (with your choice of several extenders)
Windows 3.1 EXEs (with or without the Win386 extender)
Lots of other formats you probably don't care about
If your project must run in real mode (ie. no DJGPP) and you want something with a more modern optimizer than the one in Open Watcom C/C++, there's a fork of GCC named GCC IA16 that you can try. (Though I don't know how complete its support is for the various memory models and calling conventions used in the 16-bit x86 ecosystem.)
If you want something that'll let you run the IDE and compiler on ancient hardware, the Pacific C compiler and IDE list a 286 CPU as their minimum requirement but can also be run in DOSEMU for easy integration into Linux-based build automation.
Here are a few other free C compilers for DOS, though they lack the huge ecosystems DJGPP and OpenWatcom have:
CC386
DeSmet C
Dev86
Orange C/C++ Compiler
You may also want to run the UPX compressor on the EXE files you build so you'll have more free space on any floppy images you make. (Don't forget to run it with --8086 if you're targeting something older than a 386.)
It's capable of compressing EXE, COM, and SYS files and using this sort of executable compression was commonplace back in the day.
(However, two of the three major formats UPX doesn't compress are OS/2 and Windows 3.1 executables. I'm still looking into the best option for those, given that LxLite doesn't get along with OpenWatcom-generated EXEs.)
The Turbo C compiler for DOS is just awesome, and freeware.
Official site link
http://edn.embarcadero.com//article/20841
Also there are Microsoft QuickC but I don't know how hard is to find it.
Or Watcom C, but I don't know if their OpenWatcom version works with DOS
I have installed the compiler and it worked successfully, if you want the ova here is the link
MS-DOS ova with C compiler
To open the compiler:
cd TC
TC
and that's it! You can write C and compile. The best part is that you can deal with registers and memory without any restriction.
You may want to try Open Watcom or Borland Turbo Series. There are other options but best are those 2 imho.
There are a number of compilers here:
http://www.compilers.net/dir/free/compilers/ccpp.htm
Very specifically, I have used the "Pacific C" for several different fun projects and I was pleased with both the ease of use and overall compatibility.
I was able to chase down a new URL for the download:
http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/devel/c/pacific/
You might want to take a look at FreeDOS, it includes a suite of development tools.
Open Watcom has a C compiler that will work on DOS: Open Watcom
You can save it and then create a virtual floppy with it: virtual floppy how to
This should let you install it on your virtual machine.
The Borland C++ 4.53 is the most capable, as it can output DOS (in all memory models) and Windows 3.1 and 95 executables, from several IDEs, either a DOS or Windows one. It includes command line tools, but again, it has to be hosted on a PC platform or something like DOSBox.
This original package for Borland C 4 was fairly hefty, but not nearly as insane as the literal bookshelf which came with Borland C++ 3.1. Borland C++ 3.1 is more than likely the heaviest and largest retail commercial software product box in history.
Embarcadero Technologies has released Borland C++ compiler as freeware some time ago. Sadly there's no IDE, only command line tools.
Related
I am currently looking to work with Mesa3D to create a software rendered graphic application with OpenGL.
I am looking a a few tutorials right now on how to use it, and many are written with DOS or older versions of Windows in mind. As I run Vista I don't seem to have the right files I need.
The Mesa3D tutorial I am using uses outportb() and a few other commands which I can't seem to get working. After looking around I have found you require the 2 include files:
dos.h
pc.h
These do not seem to be found within the Window's SDK that comes with Visual Studio 2010 (Express) or even the older version of 2005 (Professional) which I currently have.
They seem to be found with the DJGPP compiler that only works under DOS and is not supported in Vista, even with compatability mode. Running DosBox still does not get this to work.
I am wondering - is there perhaps a new functions replacing outportb or can I use these DJGPP files with my C/C++ complier with VS or PellesC (which I find better for C-only programs)?
In addition the conio.h include file I have with both VS and PellesC doesn't have the textmode() function, but the DJGPP version does.
If anyone could help either getting DJGPP working on Vista or allowing me to use the dos,pc and conio.h files from DJGPP with either VS or PellesC that'd be a great help!
Port-manipulating functions will simply not work in Win32 programs. Either use Win32 APIs to do I/O (rendering included) or stick to DOS and run your program in DOS or whatever DOS emulator you can find that works. Vista and later Windows won't run most DOS programs directly as the support for DOS is either severely reduced or removed altogether (e.g. in 64-bit Windows).
The low-level hardware access that functions like outportb give you is not available to programs in modern Windows environments. Such capabilities are reserved for specially-trusted code (OS internals and drivers). You need to go through higher-level APIs or drivers in order to access the same functionality.
The Mesa3D website has a readme for Windows developers that has information about what you need to install and configure. It also references some official demo code that you can use as the basis for your project. The Mesa3D website also has a repository full of demo programs that will probably serve as better examples than the out-of-date tutorials that you mentioned.
Do not use 16bit compilers on vista and higher.. instead use DOSBOX to run your programs.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm new to C(coming from Java, so I'm not learning programming for the first time). I'm reading the book, "C Primer Plus". I've been searching around to understand the differences between compilers or environments to develop C programs on Windows.
I have installed MinGW and Visual Studio 2010. I have tested compiling a hello world on both environments. For MinGW, I'm considering Code::Blocks or vim. The multi compiler support on Code::Blocks sounds convenient, but I'm not at that level to comprehend how helpful this feature would be.
I'm willing to learn C the way I should be instead of being spoiled by letting the works done background hidden by IDE like Visual Studio. Once I improve my understanding, I don't mind switching to a more convenient environments.
The reason I feel uncomfortable with Visual Studio is that it doesn't support the standards as much as gcc. I have read an argument that VS is used widely in production and that this is just the way it is. Some people say just start writing C wherever which is what I don't want. I've seen some say experience the command prompt and see how the linking is done, etc.
This is from Wikipedia, but it says that Visual C++ shouldn't be used for compiling C. http://en.wikipedia.org/wiki/Visual_C%2B%2B#Issues
So here is what I need to make clear. It might be a few blocks.
My understanding is that Visual Studio is appropriate as long as I'm developing for Windows platform and also good for people who just want to start coding.
If I want to go with the more up-to-date standards and use gcc (which is used in Linux), I should go for MinGW. MinGW is the minimum gcc-like environment ported to Windows, so I can use the similar environment to Linux which benefits me for the standards better supported than VS. Also, this is supposed to help my program to be compiled more successfully on Linux and not exactly for compiling a program on Windows MinGW to run on Linux, right?
The portability we talk about is compiling a source code on each platform and not to compile a program on one particular platform to use the executed file on other platforms, correct?
Whilst Visual C++ isn't a C compiler, the Visual studio tools do allow compiing C code - the compiler under the Visual Studion is what is used to compile almost all of Microsofts C code (and there is A LOT of C code in a Microsoft Windows system, even if a fair chunk of the newer tools may be C, the basis for a lot of things is still C). You just have to ensure that you compile C as C, not as C++, since C++ has slightly different flavours of some things - some things that are allowed in C aren't in C++.
The way to do that is to call the file something.c, rather than something.cpp - it REALLY is that easy.
gcc is also a very competent compiler, absolutely no doubt about that. And using the tools in Code::Blocks etc will be a good way to learn.
I would actually say that Visual studio is definitely a smoother, slicker environment, and you can still use command-line tools like make to build things if you like - the compiler isn't part of the IDE, it's just a nicely integrated IDE. Learning a computer language should have as few obstacles as possoible. Making life hard for yourself is no help.
I personally use (x)emacs and gcc on Linux, but the first time I programmed in C, there wasn't even a proper standard for it, and computers typically had 8- or 16-bit processors - our school computer in 1985 had 2MB of ram and 3 disks of 64MB each (131000 something blocks of 512byte). That machine had 8 terminals in my school, 8 more terminals in another school, and the main school where the actual computer was had two rooms with, I think 16 terminals in each. So we sometimes shared the machine between 30 people!
You should choose whatever platform that feels the most comfortable to you, and wait with worrying about the complications of cross platform portability etc. Coming from Java you'll get your hands full with pointers and the like in the beginning, so focus on that instead of the environment.
If you have written Java in an Eclipse environment before, the CDT plugin for C/C++ might be the way to go. It does among others support the gcc tool chain.
Regards
If you're gonna compile for Windows, try CodeBlocks, Dev-CPP or Eclipse as they all use GCC i think. Essentially you want something that doesn't force you to make a new solution/include a new project / make a new file just so you could test a few functions out. You want to compile a single .c file and run it, and play in that format.
If you're gonna compile for Linux, try Geany, Eclipse or just use gcc. Might as well pick up makefiles while you're at it.
Apart from that, write C code, or look where some of those public native java calls end up. But don't look at the math package, you'll be disappointed.
EDIT: just noticed your portability. Yes, you need to recompile on every target, or use a cross-compiler.
But cross-compiling is not enough, one must write code for different platforms too, say in Windows you will use the Win API call CreateThreadA(), but in a linux-build you will probably use pthread_create(). You should get familiar with using
//some code
#ifdef __platform_windows
//windows code here
#endif
#ifdef __platform_linux
//linux code here
#endif
//crossplatform code
I just finished a semester up of C programming for a class I'm in, and it has left me with some questions that I was hoping to get answered.
During my class we have been using GCC to compile C programs. This is all good and well, but I have a question about compiling.
What if I wanted to build a C program on Windows? There is no GCC. Is that what Microsoft Visual Studio is for?
Also, what if I wanted to compile a program and distribute it? What would I compile to distribute to other Window's users?
In summary, I know how to write C programs, but I just don't get how you would make a program to give to someone who doesn't have a C compiler and is basically computer dumb.
Thanks in advance,
Ryan
Generally you will need to do two things:
Compile your program into a stand-alone executable or binary.
a. On Windows this would be a win32 executable.
b. On Linux this would be an elf binary.
Create an installer package for your program.
a. On Windows you might use NSIS, Microsoft MSI, or InstallShield.
b. On Linux you would do well to use a packager for the distribution you want to target.
Anecodtally, it is very easy to utilize Eclipse CDT and NSIS to develop C and C++ software on Windows without needing to pay any license fees.
Eclipse CDT: http://eclipse.org/cdt/
Starter Guide: http://www.codeproject.com/KB/tips/CPP_Dev_eclipse_CDT.aspx
NSIS: http://nsis.sourceforge.net/Main_Page
Note that if you use Visual Studio then you will also need to compile in release mode and distribute the Visual Studio CRT or .NET runtime(s). It depends upon how you link to the standard library provided by your compiler.
you can get GCC for windows....
but, Visual Studio is probably a better choice.
Once you have built it, you can use something like Wix or InnoSetup to make an install program for it.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I know this question has been brought up before but it was mostly in respect to gdb for a program running on the local machine.
I've had some success with eclipse-cdt but it only seems to work occasionally. Supposedly Insight was previously used to debug (this embedded x86 board) but it seems to be dead.
I only need C debugging not C++. If possible I would prefer to connect through gdbserver (as that is on the advice and I connect to it through the command line all the time) but if you think putting gdb or ssh on the device and using it through those is better please mention those solutions also.
P.S. The version of gdbserver on the device is 7.1 it would be nice if the solution can work with a compatible version of gdb but I might be able to install a different gdbserver version.
I'd recommend eclipse Indigo it has built-in support for remote debugging applications via gdbserver. I just don't know where the source code has to be located for it to work.
Sinec it uses the MI interface of gdb it should work as any other interface that interacts with gdb.
I recommend trying out Qt Creator. It's cross-platform, has pretty good "code insight" features, and is a hell of a lot lighter-weight than Eclipse. It is a full IDE, not just a debugger front-end. It does require a gdb built with python support (client only, I think), but does come with it in its cross-platform installer. It is definitely more geared to developing C++/Qt applications, but does support generic Makefile and CMake projects, and I use it as my everyday C IDE and debugger.
Depending on exactly what kind of remote target you're debugging, the answer to this question could vary a lot. If you're cross-debugging to a deeply embedded microcontroller target running an RTOS, your options are going to be more limited.
For Makefile-based projects, you want to use the "Generic Project" creation wizard, which by default adds all the source files under the specified directory to your project. It may take some manual work to maintain your project, if you want Qt Creator to "understand" things that you've specified in your Makefile like command-line include directories (go in your .includes file), command-line included headers (go in your .config file), and command-line symbol definitions (go in your .config file). The project file list and compile, deploy, and run commands can all be maintained from the GUI though.
How about using DDD? I haven't used it much to be honest, and there seems to be a way to do remote debugging using DDD http://www.gnu.org/s/ddd/manual/html_mono/ddd.html#Remote%20Program
Gdb itself has already built-in curses based pseudo gui. By default, it splits main screen on 2 windows. Upper window contains source code, lower window is command line interface. Also there are other modes allowing to show you register values and assembly. It works well over ssh, so if you can, copy gdb on your device and debug it over ssh. If not, everything above can be applied for debugging over gdbserver.
You can use NetBeans. NetBeans support remote debugging with gdb. Gdbserver support plug-in also exist. I don't test plug-in but remote debugging using ssh working well.
Try Affinic Debugger GUI. It has newer design.
DDD is too old, Affinic Debugger supports all major platforms and is more powerful than DDD.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm fine working on Linux using gcc as my C compiler but would like a Windows solution. Any ideas? I've looked at Dev-C++ from Bloodshed but looking for more options.
You can use GCC on Windows by downloading MingW (discontinued) or its successor Mingw-w64.
You can get Visual C++ Express Edition straight from Microsoft, if you want something targeting Win32. Otherwise MinGW or lcc, as suggested elsewhere.
GCC is ubiquitous. It is trusted and well understood by thousands of folks across dozens of communities.
Visual Studio is perhaps the best IDE ever developed. It has a great compiler underneath it. But it is strictly Windows-only.
If you're just playing, get GCC --it's free. If you're concerned about multiple platfroms, it's GCC. If you're talking serious Windows development, get Visual Studio.
You could always just use gcc via cygwin.
There is another free C compiler for Windows: Pelles C.
Pelles C is a complete development kit for Windows and Windows Mobile. It contains among other things an optimizing C compiler, a macro assembler, a linker, a resource compiler, a message compiler, a make utility and install builders for both Windows and Windows Mobile.
It also contains an integrated development environment (IDE) with project management, debugger, source code editor and resource editors for dialogs, menus, string tables, accelerator tables, bitmaps, icons, cursors, animated cursors, animation videos (AVI's without sound), versions and XP manifests.
URL: http://www.smorgasbordet.com/pellesc/
I personally have been looking into using MinGW (what Bloodshed uses) with the Code Blocks IDE.
I am also considering using the Digital Mars C/C++ compiler.
Both seem to be well regarded.
GCC is not technically a linux specific compiler. Its a standards compliant c/c++ compiler, and I use it for windows programs on a daily basis. Its probably best that you use it until you become more comfortable with something else.
I recommend that you use the MinGW distribution of GCC. That will compile your programs natively for windows, using a standard library, etc.
If you're looking for an IDE, I have two recommendations. Visual Studio is the Microsoft version, and although it has its issues, it is an excellent IDE for working with the code. However, if you're looking for something a bit more lightweight, CodeBlocks is also rather good, and has the added benefit of being able to use basically any compiler you have installed (including several forms of GCC and the Microsoft Compiler that comes with Visual Studio) and being able to open project files fro other IDEs. Plus, it runs on linux too, so you could make that transition even easier on yourself.
I personally prefer GCC, but that's just me. If you really want the Microsoft Solution, VS is the way to go.
You may try Code::Blocks, which is better IDE and comes with MinGW GCC! I have used it and its just too good a freeware IDE for C/C++.
MinGW would be a direct translation off gcc for windows, or you might want to check out LCC, vanilla c (more or less) with an IDE. Pelles C seems to be based off lcc and has a somewhat nicer IDE, though I haven't used it personally. Of course there is always the Express Edition of MSVC which is free, but that's your call.
Most universities give you access to Microsoft Dreamspark.
If you're using GCC/Linux in class, just install Ubuntu. Windows is a terrible platform for C development.
Be careful to use a C compiler, not C++ if you're actually doing C. While most programs in C will work using a C++ compiler there are enough differences that there can be problems. I would agree with the people who suggest using gcc via cygwin.
EDIT:
http://en.wikipedia.org/wiki/Compatibility_of_C_and_C%2B%2B shows some of the major differences
http://www.mingw.org/wiki/HOWTO_Install_the_MinGW_GCC_Compiler_Suite
GCC works fine. Note that MSVC is not necessarily a valid solution because it does not support C99.
I'm late to this party, but for any future C folks on Windows, Visual Studio targets C90 instead of C99, which is what you'd get on *nix. I am currently targeting C99 on Windows by using Sublime Text 2 in tandem with Cygwin.
Cygwin offers full GCC support on Windows; also, the free Microsoft Visual C++ Express Edition supports 'legacy' C projects just fine.
Visual C++ Express is a fine and free IDE for Windows which comes with a compiler.
If you are more comfortable with commandline solutions in general and gcc in particular, MinGW or Cygwin might be more up you alley. They are also both free.
There have been a few comments pointing out that C is not C++. While that's true, also true that any C++ compiler will also compile C - usually the compiler mode will be automatically selected based on the filename extension, but every compiler also has an option to force C or C++ mode regardless of the filename.
So choose the free C++ compiler that you're most comfortable with gcc, VC++ Express, Digital Mars, whatever. Use the IDE you like best emacs, vim, VC++ Express, Code::Blocks, Bloodshed - again whatever.
Any of these tools will be more than adequate for learning. Personally, since you're asking about Windows, I'd choose VC++ Express - it's a great IDE, it's free, and it'll compile C programs just fine.
It comes down to what you're using in class.
If the labs and the assignments are in linux, then you probably want a MinGW solution. If they're in windows, get Visual Studio Express.
Can't you get a free version of Visual Studio Student Addition from your school? Most Universities have programs to give free software to students.
You mean Bloodshed's Dev-C++? It's a nice visual IDE for C++ which uses MinGW's gcc for Windows as the back-the-scenes compiler. The project's been abandoned for a while (in my opinion, using Delphi to develop a C++ IDE is a very stupid thing to do to draw developers' attention), however there's nothing that stops you from using it and updating the version of MinGW's gcc it uses to the latest one - besides it's GPL-licensed.
I use either BloodShed's DEV C++, CygWin, or Visual C++ Express. All of which are free and work well. I have found that for me, DEV C++ worked the best and was the least quirky. Each compiler has it's own quirks and deifferences, you need to try out a few and find the one with which you are most comfortable. I also liked the fact that DEV C++ allowed me to change the fonts that are used in the editor. I like Proggy Programming fonts!
Must Windows C++ compilers will work.
Also, check out MinGW.