tonnot
21st December 2010, 19:13
I have a little muddle with the use of a class inside another class, and mixed with the dll perspective. (Althought I dont think this were the problem)
I have a DLL built successfully: MYCLASS_A.
I have a project, i want to use myclass.dll
I create an instance of it at my main.cpp.
Then, I use it using 'extern' .
All warks fine, I can use it in other cpp files.
But...
I want to have a MYCLASS_B (also into the dll) instantiated into MYCLASS_A, I want simply to write :
MYCLASS_A.MYCLASS_B.Myfunction.
I dont know how to write and use it...
The code :
myclass_a.h
#ifndef MYCLASS_A_H
#define MYCLASS_A_H
#include "myclass_a_global.h"
#include "myclass_b.h"
class MYCLASSASHARED_EXPORT Myclass_a
{
public:
Myclass_a();
Myclass_b myclass_b1;
};
#endif
myclass_a.cpp
#include "myclass_a.h"
Myclass_a::Myclass_a()
{
}
Myclass_b myclass_b1;
When compile the project that use the DLL I have and 'undefined reference' to
myclass_a.myclass_b1.mymethod.
So, I suspect that the myclass_b1 is not really created ?
Please help....
I have a DLL built successfully: MYCLASS_A.
I have a project, i want to use myclass.dll
I create an instance of it at my main.cpp.
Then, I use it using 'extern' .
All warks fine, I can use it in other cpp files.
But...
I want to have a MYCLASS_B (also into the dll) instantiated into MYCLASS_A, I want simply to write :
MYCLASS_A.MYCLASS_B.Myfunction.
I dont know how to write and use it...
The code :
myclass_a.h
#ifndef MYCLASS_A_H
#define MYCLASS_A_H
#include "myclass_a_global.h"
#include "myclass_b.h"
class MYCLASSASHARED_EXPORT Myclass_a
{
public:
Myclass_a();
Myclass_b myclass_b1;
};
#endif
myclass_a.cpp
#include "myclass_a.h"
Myclass_a::Myclass_a()
{
}
Myclass_b myclass_b1;
When compile the project that use the DLL I have and 'undefined reference' to
myclass_a.myclass_b1.mymethod.
So, I suspect that the myclass_b1 is not really created ?
Please help....