07. juni 2004 - 14:16Der er
15 kommentarer og 2 løsninger
Hello World in C++ With Textpad?
Hello!
I would like to use TextPad with the free compiler from Borland. I have this simple code, but it will not work: #include <iostream.h>
main() { cout << "Hello World!"; return 0; }
I only get this error message:
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland c:\fredrik\c++\helloworld.cpp: Error E2209 c:\fredrik\c++\helloworld.cpp 1: Unable to open include file 'iostream.h' Error E2451 c:\fredrik\c++\helloworld.cpp 5: Undefined symbol 'cout' in function main() *** 2 errors in Compile ***
Tool completed with exit code 1
Do I have to install anything else or set some paths?
Besides the changes medions suggested (which makes the code compatible with th alatest ANSI C++ standard) you probably need to add the correct paths to the bcc32 and ilink32 config files.
It is described in the readme file if I remember correct.
The problem seems to be the things that arne_v talks about. But I changed the code to medions answer.
And I created the 2 files in C:\Borland\BCC55\: (bcc32.cfg like) -I "C:\Borland\BCC55\Include" -L "C:\Borland\BCC55\Lib"
(ilink32.cfg like) -L "C:\Borland\BCC55\Lib"
But I still get: Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland c:\fredrik\c++\helloworld.cpp: Error E2209 c:\fredrik\c++\helloworld.cpp 1: Unable to open include file 'iostream' Error E2282 c:\fredrik\c++\helloworld.cpp 3: Namespace name expected Error E2451 c:\fredrik\c++\helloworld.cpp 7: Undefined symbol 'cout' in function main() Error E2451 c:\fredrik\c++\helloworld.cpp 7: Undefined symbol 'endl' in function main() *** 4 errors in Compile ***
Tool completed with exit code 1
So if any one see any errors that I can correct please let me know.
Best regards Fredrik BTW always give svar so I can reward you!
I removed a space character at each line in the config-files like: (bcc32.cfg like) -I"C:\Borland\BCC55\Include" -L"C:\Borland\BCC55\Lib"
(ilink32.cfg like) -L"C:\Borland\BCC55\Lib"
But now I get: Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland c:\fredrik\c++\helloworld.cpp: Error E2133: Unable to execute command 'ilink32.exe'
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.