Thread: Which Compiler?

  1. #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

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    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.

  3. #3
    Registered User
    Join Date
    Feb 2009
    Posts
    278
    That is what I was afraid of...

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    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.

  5. #5
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    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

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    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.

  7. #7
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    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.
    Last edited by brewbuck; 02-10-2009 at 06:31 PM.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  8. #8
    Registered User
    Join Date
    Feb 2009
    Posts
    278
    What is the newest version of Turbo C that would work for me?

  9. #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.

  10. #10
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > 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.
    If at first you don't succeed, try writing your phone number on the exam paper.

  11. #11
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

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

Tags for this Thread