Home >Backend Development >C++ >Why Does My 'Hello World' Program Produce Compile Errors in Turbo C ?
Compile Errors in Turbo C for "Hello World" Program
When attempting to compile a "Hello World" program using Turbo C , users may encounter the following errors:
Errors:
Error D:\HELLO.CPP 1: Unable to open include file 'IOSTREAM' Error D:\HELLO.CPP 2: Declaration syntax error Error D:\HELLO.CPP 6: Undefined symbol 'cout'
Cause:
These errors stem from Turbo C 's use of pre-ANSI C , an outdated dialect that lacks features present in modern C implementations.
Solution:
To resolve these errors, modify the program as follows:
#include <iostream.h> // use ".h" suffix for include file // remove "using namespace std;" int main() { cout << "Hello, World!"; return 0; }
Comparison to Modern C :
The program written for Turbo C differs from its modern C counterpart primarily due to the inclusion of the ".h" suffix in the header file and the absence of namespace support.
Disadvantages of Turbo C :
While it is possible to learn programming using Turbo C , it is strongly discouraged for the following reasons:
Recommended Alternatives:
Consider using modern free and powerful compilers such as:
The above is the detailed content of Why Does My 'Hello World' Program Produce Compile Errors in Turbo C ?. For more information, please follow other related articles on the PHP Chinese website!