Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Exception mechanism of boost.regex conflicts with QT lib
Forum Updated to NodeBB v4.3 + New Features

Exception mechanism of boost.regex conflicts with QT lib

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 4.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    facat
    wrote on last edited by
    #1

    a short piece of code:
    @
    /////////////////////////////////////
    boost::regex reg;;
    try { reg.assign( "[]d"); }
    catch(std::runtime_error & e) { //exception }
    //////////////////////////
    @
    this code runs well in Eclipse with MingW. When I copy this code in my QT project and run, it seems that QT lib cannot handle the exception which boost.regex lib throws. A run time termination warning shows as a result. I'm using win7 64bit. My QT is integrated with MingW 4.4 .

    Did any one encounter a similar problem? Could someone help me ?

    [edit: please add @ code tags, Eddy]

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      AFAIK, Qt has exception handling turned off by default. But there should be switches in the pro file to switch it on again.

      Look at the "CONFIG variable description":http://doc.qt.nokia.com/4.7/qmake-variable-reference.html#config

      [quote]
      These CONFIG values control compilation flags:
      .....
      These options are used to set the compiler flags:
      ...
      exceptions --> Exception support is enabled.
      ...
      [/quote]

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • F Offline
        F Offline
        facat
        wrote on last edited by
        #3

        [quote author="Gerolf" date="1322296085"]AFAIK, Qt has exception handling turned off by default. But there should be switches in the pro file to switch it on again. Look at the "CONFIG variable description":http://doc.qt.nokia.com/4.7/qmake-variable-reference.html#config [quote] These CONFIG values control compilation flags: ..... These options are used to set the compiler flags: ... exceptions --> Exception support is enabled. ... [/quote][/quote]
        adding exception to CONFIG variant doesn't work. Besides, there is message
        " Invalid parameter passed to C runtime function. "

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          @
          -no-exceptions ..... Disable exceptions on compilers that support it.

          • -exceptions ........ Enable exceptions on compilers that support it.
            @

          The asterisk denotes the default.

          Exception support should be enabled on all majore platforms by default. I know for sure it works on Windows (Visual Studio and MinGW) and the Mac, as I successfully catch exceptions thrown by GraphicsMagick.

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • F Offline
            F Offline
            facat
            wrote on last edited by
            #5

            Finally I found the problem. It's because boost.regex and my QT project was built under different version of gcc.

            My regex was built under gcc 4.6. The default gcc which qt implements is gcc 4.4. So gcc 4.4 cannot handle the exception from libs built under gcc 4.6.

            When I set the Path in Build Settings-> Build Environment, indicated qt compiler to find my gcc 4.6, everything is right.

            Still I got a warning:
            :-1: warning: cannot find entry symbol nable-stdcall-fixup; defaulting to 00401000

            It seems qt still implements an old version ld.exe?

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #6

              It does not cure the cause of your problems if you tweak the compiler settings in Creator. Your Qt is still built with gcc 4.4. So either rebuild Qt using gcc 4.6 or build your boost libs using gcc 4.4. Everything else is playing roulette, but not a stable solution.

              In general, it's almost never a good idea to mix object code built by different releases of a compiler (gcc 4.4 vs 4.6, Visual Studio 2008 vs. 2010, etc.)

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved