Feb 26, 2014 at 11:08pm UTC
Hi guys, facing some issues here:
Waz is in a DLL named Test
Waz.h
// Import/Export Pattern
#ifdef TEST_EXPORTS
#define DllExport __declspec(dllexport)
#else
#define DllExport __declspec(dllimport)
#endif
#pragma once
#ifndef __Test__Waz__
#define __Test__Waz__
#include "WazImpl.h"
class DllExport Waz
{
/* Friends */
friend class WazImpl;
friend Waz operator*(const Waz &,const Waz &);
private:
WazImpl *p;
...
public:
...
};
#endif /* defined(__Test__Waz__) */
Waz operator*(const Waz &,const Waz &);
-------
Waz.cpp
(all def of the operator in public and ...)
Waz operator*(const Waz & w1, const Waz & w2)
{
Waz ww;
*ww.p=*w1.p * *w2.p;
return ww;
}
Then in the solution I have a console application and in my main
int main()
{
Waz a;
a(1,1) =3 ; // this line works fine operator() is defined in the public of the Waz class
Waz b;
Waz c = a*b; // ERROR
ERROR:
error LNK2019 : unresolved external symbol "class Waz __cdecl operator*(class Waz const &, class Waz const &)" (??D@YA?AVWaz@@ABV0@0@Z) referenced in the function _main
error LNK1120 : 1 unresolved external symbol
Any idea? Don't know what to do anymore to solve this..
Thanks in advance!!
Feb 26, 2014 at 11:11pm UTC
Code tags can help us try to analyze code. Are you sure the operator is being exported?
Feb 26, 2014 at 11:19pm UTC
For sure class Waz is exported as I can put in my main Waz a; or use it's operator.
I think you might be right and my operator * is not exported but when I put in front of it DllExport (what I did to export the class) it gives me a new error :
error C2375 : operator* redefinition different linking