Like Tree2Likes
  • 1 Post By Elkvis
  • 1 Post By Salem

try keyword does't work

This is a discussion on try keyword does't work within the C++ Programming forums, part of the General Programming Boards category; 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 ...

  1. #1
    Registered User
    Join Date
    Jul 2010
    Posts
    4

    try keyword does't work

    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.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,794
    Are you sure you are compiling as C++? What is this program that you tried?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,592
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    Jul 2010
    Posts
    4
    yes,I'm using it as a cpp file....but..shows the same

  5. #5
    Registered User
    Join Date
    Jul 2010
    Posts
    4
    ya its a cpp file...even if its a simple program (like division by zero) it shows the same error

  6. #6
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,794
    Try compiling this program:
    Code:
    #include <vector>
    #include <new>
    
    int main()
    {
        try
        {
            std::vector<int> numbers(1000);
            numbers.resize(2000);
        }
        catch (const std::bad_alloc& e)
        {
        }
    }
    If there is an error, show the entire error message.

    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.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  7. #7
    Registered User
    Join Date
    Jul 2010
    Posts
    4
    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.

  8. #8
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,794
    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.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  9. #9
    Registered User
    Join Date
    Oct 2006
    Posts
    2,457
    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.

  10. #10
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,592
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  11. #11
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,651
    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.

  12. #12
    Registered User
    Join Date
    Oct 2006
    Posts
    2,457
    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?

  13. #13
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,282
    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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. getline() don't want to work anymore...
    By mikahell in forum C++ Programming
    Replies: 7
    Last Post: 07-31-2006, 10:50 AM
  2. Why don't the tutorials on this site work on my computer?
    By jsrig88 in forum C++ Programming
    Replies: 3
    Last Post: 05-15-2006, 10:39 PM
  3. Problems in getting OpenGL to work
    By zonf in forum C Programming
    Replies: 5
    Last Post: 02-13-2006, 03:48 AM
  4. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 11:39 AM
  5. DLL __cdecl doesnt seem to work?
    By Xei in forum C++ Programming
    Replies: 6
    Last Post: 08-21-2002, 04:36 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21