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. Segfault in C++ standard library from call of function in external library

Segfault in C++ standard library from call of function in external library

Scheduled Pinned Locked Moved General and Desktop
segfaultxlslib
5 Posts 3 Posters 2.1k Views
  • 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.
  • A Offline
    A Offline
    aeturnus
    wrote on 22 Jul 2015, 06:15 last edited by aeturnus
    #1

    Hi, I'm new to Qt, and am using Qt Creator.

    I'm using Windows 8.1 and am using the non-Qt MinGW to compile.

    I have a program that is currently working perfectly fine as a non-Qt terminal application, built with Cmake. I was planning on using Qt to act as a frontend, with the Qt project itself using sources and headers from the original non-Qt project and using qmake.
    I am statically linking the library "xlslib" to use to output .xls files. However, I run into a problem whenever I run the Qt application: a segmentation fault occurs whenever I call the "Dump()" function in xlslib to actually create the .xls file.
    Using the debugger, I found that the segfault was occurring in basic_ofstream, at the instruction "lock subl $0x1,(%ebx)" in "libstdc++-6!ZNSt6localeaSERKS".

    This does not occur in the non-Qt terminal application and has no issues when "Dump()" is called. Even if I use the Qt Creator Qt Terminal application project template and using the same main() the segfault occurs at the call of the "Dump()" function of "xlslib".

    The only compiler flag used was "-std=c++11" for the non-Qt application; for the Qt one "CONFIG += c++11" was added to the .pro.

    All the other functions in "xlslib" appear to be working fine.

    I was wondering if anything could be done for this segfault, and if it may have to do with some settings in Qt Creator or .pro that I was unaware of.

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on 22 Jul 2015, 07:08 last edited by
      #2

      Hi and welcome to devnet

      What compiler is used when your terminal application runs perfectly?

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      1
      • A Offline
        A Offline
        aeturnus
        wrote on 22 Jul 2015, 08:37 last edited by aeturnus
        #3

        The compiler I'm using is MinGW 3.21 with G++4.8.1

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on 22 Jul 2015, 08:57 last edited by
          #4

          You have installed this compiler separately?
          Which version of Qt are you using?
          I would recommend trying a compilation the same MinGW compiler as distributed with your Qt version. MinGW is in most cases compatible between versions (in contrast to MSVC), but possibly the different compiler might be the cause of your problem.

          With your c++11 settings I would expect a compile error rather than a seg fault. There are a couple of posts relating to using c++11 flag in this forum. Unfortunately the tag flag does not work for this tag. Try to use the find functionality for fitting posts.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • V Offline
            V Offline
            VRonin
            wrote on 22 Jul 2015, 09:57 last edited by VRonin
            #5

            I know, I too hate when people propose an alternative instead of answering the actual question but please forgive me this time.
            QXlsxWriter is a Qt based library to read and write excel files and I did not have many problems with it so far

            "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
            ~Napoleon Bonaparte

            On a crusade to banish setIndexWidget() from the holy land of Qt

            1 Reply Last reply
            0

            4/5

            22 Jul 2015, 08:57

            • Login

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