Boost logo

Boost Users :

Subject: [Boost-users] A linking error on using lambda expression in dll . Can anyone with kindness help me?
From: fmingu (fmingu_at_[hidden])
Date: 2009-07-22 22:26:57


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?

 



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net