ranzani
21st June 2011, 10:05
I built my library "name" -> libname.a
QT -= gui
TARGET = name
TEMPLATE = lib
CONFIG += staticlib
(Also trying with dynamic -> libname.so ... )
This library contains a class
#include <...>
class NAMESHARED_EXPORT ClassName
{
public:
ClassName();
~ClassName();
QString getAttrVal( const int a,
const int b,
const char *data,
QString *description );
...
private:
...
};
NOW IN AN OTHER PROJECT I NEED TO CALL THE FUNCTIONS implemented in this library:
Eg.
.pro
LIBS += -Llib/ -lname
.h
class xxx
{
private:
ClassName *CN;
public:
xxx();
}
.cpp
xxx::xxx(){
CN = new ClassName();
QString test = CN->getAttrVal( 1, 2, "ciao", "bau" );
}
BUT WHEN COMPILE:
/xxx.h:188: error: ISO C++ forbids declaration of ‘ClassName’ with no type
Any suggestion? :confused:
QT -= gui
TARGET = name
TEMPLATE = lib
CONFIG += staticlib
(Also trying with dynamic -> libname.so ... )
This library contains a class
#include <...>
class NAMESHARED_EXPORT ClassName
{
public:
ClassName();
~ClassName();
QString getAttrVal( const int a,
const int b,
const char *data,
QString *description );
...
private:
...
};
NOW IN AN OTHER PROJECT I NEED TO CALL THE FUNCTIONS implemented in this library:
Eg.
.pro
LIBS += -Llib/ -lname
.h
class xxx
{
private:
ClassName *CN;
public:
xxx();
}
.cpp
xxx::xxx(){
CN = new ClassName();
QString test = CN->getAttrVal( 1, 2, "ciao", "bau" );
}
BUT WHEN COMPILE:
/xxx.h:188: error: ISO C++ forbids declaration of ‘ClassName’ with no type
Any suggestion? :confused: