I tried to write a c++ program using exception handling (try/catch).While compiling,it shows the error message"undefined symbol try".How can overcome it?Please give me a solution.
I tried to write a c++ program using exception handling (try/catch).While compiling,it shows the error message"undefined symbol try".How can overcome it?Please give me a solution.
Are you sure you are compiling as C++? What is this program that you tried?
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
You're not trying to do this with some 20+ year old "Turbo" thing are you?
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.
yes,I'm using it as a cpp file....but..shows the same
ya its a cpp file...even if its a simple program (like division by zero) it shows the same error
Try compiling this program:
If there is an error, show the entire error message.Code:#include <vector> #include <new> int main() { try { std::vector<int> numbers(1000); numbers.resize(2000); } catch (const std::bad_alloc& e) { } }
What compiler are you using?
Last edited by laserlight; 07-13-2010 at 11:16 AM. Reason: <new> is the header for std::bad_alloc.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
turbo c++ version.3
the pgm shows 5 errors
unable to open include file'VECTOR'
unable to open include file'NEW'
undefined symbol try
statement missing ;
compund stmt missing }
function should return a value
Last edited by arunvl; 07-13-2010 at 11:36 AM.
Time to change compiler. There is no other way, unless you want to learn pre-standard C++ and be obsolete even before you have started.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
perhaps slightly off topic, but where the hell do people keep coming up with turbo C 3.0? are colleges still using that crap and providing it to their students? if so, do they not realize that they are setting their students up for failure? it's ridiculous that a college would offer a class on C++ and not even teach a standard version of it. there are free standards-compliant C++ compilers available, and anyone who would deliberately use a non-standard compiler is only shooting him/herself in the foot.
Apparently, TurboCrap is the MANDATED compiler for the entire Indian sub-continent.
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.
Southern Asia in general, it seems. Pakistan, Phillipines, Sri Lanka, Nepal, and Bangladesh are among the other countries that seem to favor these old things.
It just seems odd because this is at least the second thread related to TC3 within the last few days, and it seems to come up at least a few times a month as well. is it available to download for free somewhere?
I don't think it is anymore, but for a very long time you could download compiler releases of the "TurboC", "TurboC++", "Borland C++", series and several other Borland and Inprise development tools from their support website.
You can probably still find them linked through archival services.
[Edit]
That isn't to say that people are legally allowed to distribute those tools. The developers didn't require you to register or anything, but they were technically provided as part of legacy support for current generation tool suites.
[/Edit]
Soma
Last edited by phantomotap; 07-13-2010 at 03:46 PM. Reason: none of your business