How to use Qt to call C++ standard library?
-
wrote on 17 Jan 2011, 03:09 last edited by
Hello ,there is a Qt project ,I need to use C++ standard library,I config the .pro file as follows:
LIBS+=opc/SeyOPC.lib
.........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! -
wrote on 17 Jan 2011, 07:20 last edited by
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?
-
wrote on 17 Jan 2011, 07:31 last edited by
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*);
-
wrote on 17 Jan 2011, 11:37 last edited by
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.
-
wrote on 17 Jan 2011, 16:28 last edited by
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.
-
wrote on 18 Jan 2011, 05:29 last edited by
Thanks for your help ! I have the the solution by using the QLibrary class!
1/6