grayfox
5th July 2011, 17:15
In a shared lib, I have the following:
#ifndef SHAREDLIB_H
#define SHAREDLIB_H
#include "SharedLib_global.h"
namespace Fx{
SHAREDLIBSHARED_EXPORT int FunctionUnderNamespace();
}
SHAREDLIBSHARED_EXPORT int FunctionOutsideNamespace();
#endif // SHAREDLIB_H
This will compile without problem, but in the app source file:
#include <SharedLib.h>
#include <QDebug>
int main()
{
//int v = Fx::FunctionUnderNamespace(); // link error
int v = FunctionOutsideNamespace(); // works fine
qDebug() << v;
return 0;
}
Calling the function under a namespace will not even be compiled.
Do I actually need to export the namespace?
#ifndef SHAREDLIB_H
#define SHAREDLIB_H
#include "SharedLib_global.h"
namespace Fx{
SHAREDLIBSHARED_EXPORT int FunctionUnderNamespace();
}
SHAREDLIBSHARED_EXPORT int FunctionOutsideNamespace();
#endif // SHAREDLIB_H
This will compile without problem, but in the app source file:
#include <SharedLib.h>
#include <QDebug>
int main()
{
//int v = Fx::FunctionUnderNamespace(); // link error
int v = FunctionOutsideNamespace(); // works fine
qDebug() << v;
return 0;
}
Calling the function under a namespace will not even be compiled.
Do I actually need to export the namespace?