[Qt-interest] Can we use non qt-library created using QT in VC++?

Chakresh Sharma cxs at tetrahedrix.com
Sun Oct 11 08:14:50 CEST 2009


Thanx Marco!

It gave me new direction to read on!

On Sat, Oct 10, 2009 at 7:28 PM, Marco Borm <qt-lists at retrodesignfan.eu>wrote:

> The problem is the incompatible name mangling of c++ symbols between
> WinGW and the MS compiler. You can find more informations here:
> http://www.mingw.org/wiki/MixingCompilers
>
> Chakresh Sharma wrote:
> > Hi,
> >
> > I tried to created a non-static library using Qt Creator. First of all
> > it creates libProjName.a instead of .lib extention? Does extention
> > really matters?
> >
> > Also if i try to add this library in project in vc++ it gives
> > following linking errors:
> >
> > testHello error LNK2019: unresolved external symbol "public: void
> > __thiscall Hello::sayHello(void)" (?sayHello at Hello@@QAEXXZ) referenced
> > in function _main
> > testHello error LNK2019: unresolved external symbol "public:
> > __thiscall Hello::Hello(void)" (??0Hello@@QAE at XZ) referenced in
> > function _main
> > testHello fatal error LNK1120: 2 unresolved externals
> >
> >
> > My .Pro file is :
> >
> > #-------------------------------------------------
> >
> > #
> >
> > # Project created by QtCreator 2009-10-10T17:16:33
> >
> > #
> >
> > #-------------------------------------------------
> >
> > QT -= gui
> >
> > TARGET = Hello
> >
> > TEMPLATE = lib
> >
> > CONFIG += staticlib
> >
> > SOURCES += hello.cpp
> >
> > HEADERS += hello.h
> >
> >
> > The cpp file is :
> >
> >
> > #include "hello.h"
> >
> > Hello::Hello()
> >
> > {
> >
> > }
> >
> > void Hello::sayHello()
> >
> > {
> >
> > int i = 0;
> >
> > }
> >
> >
> > and header is
> >
> >
> > #ifndef HELLO_H
> >
> > #define HELLO_H
> >
> > class Hello {
> >
> > public:
> >
> > Hello();
> >
> > void sayHello ();
> >
> > };
> >
> > #endif // HELLO_H
> >
> >
> >
> > I use above three files to create a library. it creates libHello.a
> >
> >
> > My vc++ project contains following code :
> >
> >
> > // testHello.cpp : Defines the entry point for the console application.
> > //
> >
> > #include "stdafx.h"
> > #include <Hello.h>
> > int _tmain(int argc, _TCHAR* argv[])
> > {
> > Hello obj;
> > obj.sayHello ();
> >     return 0;
> > }
> >
> >
> > Can any one suggest any hint why it is happening?
> >
> >
> > Regards,
> >
> > Chakresh
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Qt-interest mailing list
> > Qt-interest at trolltech.com
> > http://lists.trolltech.com/mailman/listinfo/qt-interest
> >
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091011/e1f40aaa/attachment.html 


More information about the Qt-interest-old mailing list