A linking error on using lambda expression in dll . Can anyone with kindness help me?
I am using Dev-C++ and lambda expression (boost 1.34.1). I created a dll containing a class. And want other programs to use the memberfunctions in the class. the dll.h is: .......................... #if BUILDING_DLL # define DLLIMPORT __declspec (dllexport) #else /* Not BUILDING_DLL */ # define DLLIMPORT __declspec (dllimport) #endif /* Not BUILDING_DLL */ ............ class DLLIMPORT classA{ private: ............ public: int function1(const int& ); ............... }; the dll.cpp is: # include "dll.h" ....................... int classA::function1(const int& testnumber){ ..................... } ........................ In the classA::function1 in dll.cpp I used the lambda expression and the above dll is created OK. and the main executable using the dll is: # include "dll.h" ................................ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil) ....................... classA instanceA; instanceA.function1(3); ..................... the complier told me no errors but the linker told me that : [Linker error] undefined reference to `classA::Function1(int const&)' And I do not know how to solve it. Does this error occur due to the use of lambda expression? Can anyone with kindness help me?
2009/7/23 fmingu
Does this error occur due to the use of lambda expression?
No.
Can anyone with kindness help me?
Check that you are linking to dll.lib (import library of your dll). Check that BUILDING_DLL is defined while building the dll and not defined while building the executable. Roman Perepelitsa.
participants (2)
-
fmingu
-
Roman Perepelitsa