Hi I have written a program in visual c++ and for whatever reason now i need to run/compile this same program in turbo c++ 3.0.
I have managed to get the compiler from some source but I get a lot of errors when i try to compile my code. I have commented out "#include stdafx.h" set the appropriate paths for the directories and libraries in the ide. these are the lines that give me errors
#include <list开发者_StackOverflow中文版> //Error unable to open include file list
using namespace std; //Declaration syntax error
typedef list<int> itemist; // , expected
bool setPlayerChar(char key); // Type name expected // Declaration missing ;
void generateItemList(piece market[9], itemlist &ilist) // ) expected
bool exit = false; // Undefined symbol 'bool' // statement missing ;
When Turbo C++ 3.0 was state-of-the-art several years ago, a lot of C++ things of today did not exist. No STL, no <list>
, no namespaces, not even the type bool
(was typically emulated by a macro 'BOOL'). When I remember correctly, it was just a 16 bit compiler, what gives you additional "fun" with int
and pointer arithmetik.
Happy porting ;-)
You could try these ugly hacks:
/* Check if the compiler is Borland Turbo C++ 3.0 or earlier */
#ifdef __BORLANDC__
#if (__BORLANDC__ <= 0x400)
#include <list.h>
typedef int bool;
#define true (1)
#define false (0)
#else
#include <list>
#endif
and so on, but instead, consider using a more recent compiler, such as GCC or MSVC.
If you really need to run your application in DOS and the machine is at least 80386, I would suggest using DJGPP. It provides recent GCC. Your application will then run in x86 protected mode.
If you need to build your program for DOS, you may try Borland C++ 5.02. It is the last Borland's compiler that supported DOS, and included some pre-standard STL.
Code like this:
#include <list>
using namespace std;
typedef list<int> itemist;
should be compilable with it.
精彩评论