C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 02-10-2009, 06:04 PM   #1
Registered User
 
Join Date: Feb 2009
Posts: 278
Which Compiler?

I am currently writing software for a small Single Board Computer (SBC). I am developing the software in C/C++ ( I would like to stick to C if I can). I am currently using the ancient Turbo C++ 3.0 Compiler but I would like to upgrade. People have suggested Microsoft Visual C++ 2008 Express Edition but I'm concerned about the implications of my compiler choice on the final product since the SBC only runs DOS. I would prefer an IDE over a command line compiler, but if a command line compiler is a better choice...

Oh, and the compiler needs to be free too :P

Thanks in advance
Bladactania is offline   Reply With Quote
Old 02-10-2009, 06:06 PM   #2
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
Unfortunately, if all you have is DOS, then you are stuck with 16-bit compilers, and whilst Turbo C is not great (and in particular, it is not MODERN), it is still one of the few easily available DOS compilers. Doubt you will find something MUCH better. Microsoft Visual C 1.52 used to be another 16-bit compiler. Don't know if it's available anywhere.

--
Mats
__________________
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
matsp is offline   Reply With Quote
Old 02-10-2009, 06:07 PM   #3
Registered User
 
Join Date: Feb 2009
Posts: 278
That is what I was afraid of...
Bladactania is offline   Reply With Quote
Old 02-10-2009, 06:09 PM   #4
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
Of course, if you are not using too much "DOS stuff" (or the "DOS stuff" is isolated enough), you could always compile the whole project for Windows in a modern compiler, and then recompile it only when you have it working for the target system. This doesn't work if you are using special hardware on the SBC, of course.

--
Mats
__________________
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
matsp is offline   Reply With Quote
Old 02-10-2009, 06:18 PM   #5
and the hat of sweating
 
Join Date: Aug 2007
Location: Toronto, ON
Posts: 3,120
Aren't there any 16-bit versions of gcc around?
__________________
"I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008
cpjust is offline   Reply With Quote
Old 02-10-2009, 06:24 PM   #6
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
Quote:
Originally Posted by cpjust View Post
Aren't there any 16-bit versions of gcc around?
Not that I'm aware of. For Xen, which needs a BIOS built to do hardware supported virtual machines, we used bcc (which is NOT the Borland compiler) to compile the BIOS code. But for a DOS type environment, Turbo C is probably better.

--
Mats
__________________
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
matsp is offline   Reply With Quote
Old 02-10-2009, 06:27 PM   #7
Senior software engineer
 
brewbuck's Avatar
 
Join Date: Mar 2007
Location: Portland, OR
Posts: 5,381
Quote:
Originally Posted by cpjust View Post
Aren't there any 16-bit versions of gcc around?
You can use GCC to build 16-bit code, but it's hacky. Insert this at the very beginning of the .c file (outside of all functions, and before anything else):

Code:
__asm__(".code16");
I've done this before, but I make no guarantees!

EDIT: Of course, gas is going to produce ELF output unless you're running a weird version of gas. This ELF will have to be massaged into a flat binary:

Code:
gcc -c foo.c
ld -o foo foo.o
objcopy -O bin foo foo.bin
Or something like that. You'll need a linker script to configure the right address space.
__________________
"Congratulations on your purchase. To begin using your quantum computer, set the power switch to both off and on simultaneously." -- raftpeople@slashdot

Last edited by brewbuck; 02-10-2009 at 06:31 PM.
brewbuck is offline   Reply With Quote
Old 02-10-2009, 08:23 PM   #8
Registered User
 
Join Date: Feb 2009
Posts: 278
What is the newest version of Turbo C that would work for me?
Bladactania is offline   Reply With Quote
Old 02-10-2009, 08:55 PM   #9
Registered User
 
Join Date: Oct 2008
Posts: 115
Quote:
Originally Posted by Bladactania View Post
What is the newest version of Turbo C that would work for me?
Maybe you could try this this is a command line compiler. It's Borland C++ compiler 5.5.
$l4xklynx is offline   Reply With Quote
Old 02-11-2009, 12:15 AM   #10
and the hat of vanishing
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,214
> Maybe you could try this this is a command line compiler. It's Borland C++ compiler 5.5
But it doesn't produce 16-bit executables.

These also generate 16-bit DOS code
http://www.openwatcom.org/index.php/Main_Page
http://www.digitalmars.com/

DJGPP generates 32-bit DOS code, but you would also need a DOS extender running as well to support that.
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
Up to 8Mb PlusNet broadband from only £5.99 a month!
Salem is offline   Reply With Quote
Old 02-11-2009, 01:32 AM   #11
Registered User
 
Join Date: Sep 2006
Posts: 2,509
I'm no expert on Turbo C, but I have used it (as Turbo C/C++ ver. 1.01), quite a bit, and still do, sometimes.

I've been told that Turbo C ver 2.n (not the same as Turbo C/C++), was buggy, and to avoid it. Turbo C/C++ on the other hand, is fine. You'll want to set it up to compile your *.c programs, with the C compiler, rather than the C++ one. (it's a simple option you choose in the IDE).

I like ver. 1.01 of Turbo C/C++. Oddly, it's newer than Turbo C ver. 2.n, I've been told. It's available at the Borland legacy site, google for the url.

If your console screen buffers are too small, you'll only get a 1/2 size of the IDE window, which is horrid. Once you set up the screen buffers, and make your properties for the shortcut to it that you'll want, show full screen, then you'll be fine.
Adak is online now   Reply With Quote
Reply

Tags
compiler

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiler Paths... Cobra C++ Programming 5 09-26-2006 04:04 AM
C Compiler and stuff pal1ndr0me C Programming 10 07-21-2006 11:07 AM
I can't get this new compiler to work. Loduwijk C++ Programming 7 03-29-2006 06:42 AM
how to call a compiler? castlelight C Programming 3 11-22-2005 11:28 AM
Bad code or bad compiler? musayume C Programming 3 10-22-2001 09:08 PM


All times are GMT -6. The time now is 02:34 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22