Important: Please read the Qt Code of Conduct -

How to use Qt to call C++ standard library?

  • Hello ,there is a Qt project ,I need to use C++ standard library,I config the .pro file as follows:


    but the compiler give compiling errers like this:
    undefined reference to `SeyOPC::initialize(char const*, char const*)

    Is there anyone knowing how using C++ standard library with Qt?
    if there is ,Please give me some advice ,thanks!
    I'm waiting!

  • Hi xjruan

    First of all, we need more information:

    which is your platform?
    Do you use QtCreator and which version?
    Which compiler do you use? Mingw?

    What is a C++ standard library? You mean a C++ library that exports pure C++ objects? With which compiler is this lib build?

  • My platform is win7-64bit, and use QtCreator 2.0 ,Qt version is 4.7.0, the compiler is Mingw;
    The lib is built by Visual Studio 2008 SP1.

    the export method is as below:

    extern "C" __declspec(dllexport) void init(char const*, char const*);

  • You cannot mix C++ libraries built with Visual Studio and MinGW. Google for "name mangling" if you want to learn the reasons.

    You must either build your library with MinGW too or use Visual Studio 2008 SP1 for your project.

  • I had the same issue in the past... I was still a beginner and I still remember the days spent on testing Qt on MinGW and VS2005. Nice days. Didn't know about name mangling however.

  • Thanks for your help ! I have the the solution by using the QLibrary class!

Log in to reply