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

Chakresh Sharma cxs at tetrahedrix.com
Sat Oct 10 15:22:43 CEST 2009


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091010/bfbd2963/attachment.html 


More information about the Qt-interest-old mailing list