title: unresolved external symbol visual studio 2010 error
body: <p>i've implemented with visual studio 2010 professional a solution containing 2 projects; the first called OptDll consist of a dynamic library with a method i want to export, while the second is a exe project, called prova, in order to try the dll.
  I've included the correct references and all work fine until i decided to insert in OptDll project a new class (GlobalOutput) in order to create the output parameters i want. When i build the project OptDll no error occurs but when i build the whole solution i get these errors in the prova project:</p>
  
  <pre><code>Error   59  error LNK2019: unresolved external symbol "public: __thiscall GlobalOutput::~GlobalOutput(void)" (??1GlobalOutput@@QAE@XZ) referenced in function _main C:\Users\ANTONIO\Desktop\optDll\prova\prova.obj
  
  Error   60  error LNK2019: unresolved external symbol "public: __thiscall GlobalOutput::GlobalOutput(void)" (??0GlobalOutput@@QAE@XZ) referenced in function _main  C:\Users\ANTONIO\Desktop\optDll\prova\prova.obj
  
  Error   61  error LNK1120: 2 unresolved externals   C:\Users\ANTONIO\Desktop\optDll\Debug\prova.exe 1
  </code></pre>
  
  <p>I read it could be a problem with the class constructor/destructor but i don't fix it.
  Below the code of interest.</p>
  
  <pre><code>OptFunDll.h
  #ifdef OPTFUNDLL_EXPORTS
  #define OPTFUNDLL_API __declspec(dllexport) 
  #else
  #define OPTFUNDLL_API __declspec(dllimport) 
  #endif
  
  //#include "tool_library.h"
  #include "GlobalOutput.h"
  
  namespace optFun
  {
      // This class is exported from the optFunDll.dll
      class myoptFun
      {
      public: 
          // funzione che implementa il modulo di ottimizzazione
          class OPTFUNDLL_API GlobalOutput;
          static OPTFUNDLL_API void scheduling(const char*,const char*,const char*,const char*,GlobalOutput&amp;); 
  
  
      };
  }
  
  OptFunDll.cpp
  #include "stdafx.h"
  #include "optFunDll.h"
  #include &lt;stdexcept&gt;
  
  using namespace std;
  
  ::Random Particle::_rnd;
  ::Random ParticleSwarm::_rnd;
  
  namespace optFun
  {
      void myoptFun::scheduling(const char *pRicette,const char *pWarehouse,const char *pFarmacia,const char *pShaker,GlobalOutput&amp; total){
  //here some code...
  //class definition
  total.CreateDataPrescription(final_list);
  total.time=time_output;
  
  GlobalOutput.h
  #include &lt;afxwin.h&gt;         // MFC core and standard components
  #include &lt;afxext.h&gt;         // MFC extensions
  #include &lt;afxadv.h&gt;
  #include &lt;afxdisp.h&gt;        // MFC Automation classes
  #include &lt;afxdtctl.h&gt;        // MFC support for Internet Explorer 4 Common Controls
  #ifndef _AFX_NO_AFXCMN_SUPPORT
  #include &lt;afxcmn.h&gt;            // MFC support for Windows Common Controls
  #endif // _AFX_NO_AFXCMN_SUPPORT
  #include "GlobalInfo.h"
  #include "tool_library.h"
  
  struct DataPrescription{
      EDrug  NameDrug;
      double Dosage;
      EContainerType DestType;
      ELiquid IdDest;
      double CapacityDest;
      double Priority;
      bool ScaricoShaker;
  
      DataPrescription(){
          NameDrug=EDrug_NoDrug;
          Dosage=0.0;
          DestType= EContainerType_Tot;
          IdDest=ELiquid_NoLiquid;
          CapacityDest=0.0;
          Priority=0.0;
          ScaricoShaker=true;
      }
  
      DataPrescription(EDrug name,double dos,EContainerType dest,ELiquid ID,double cap_dest,double p,bool _ScaricoShaker){
          NameDrug=name;
          Dosage=dos;
          DestType=dest;
          IdDest=ID;
          CapacityDest=cap_dest;
          Priority=p;
          ScaricoShaker=_ScaricoShaker;
      }
  };
  
  class GlobalOutput{
  public:
      CArray&lt;DataPrescription&gt; OptList;
      time_info time;
  
      GlobalOutput();
      ~GlobalOutput();
  
      void CreateDataPrescription(vector&lt;ricetta&gt;&amp;);
  };
  
  
  #endif
  
  GlobalOutput.cpp
  #include "stdafx.h"
  #include "GlobalOutput.h"
  
  GlobalOutput::GlobalOutput(){
      time.total_makespan=0;
  }
  
  GlobalOutput::~GlobalOutput(){
  }
  
  void GlobalOutput::CreateDataPrescription(vector&lt;ricetta&gt;&amp; list){
  
      //DataPrescription tmp;
  
      for(unsigned int i=0;i&lt;list.size();i++){
          DataPrescription tmp(list[i].getID(),list[i].getdosage(),list[i].get_destination(),list[i].get_DestType(),list[i].get_CapacityDest(),list[i].getPriority(),list[i].processing_info.scarico_shaker);
          this-&gt;OptList.Add(tmp);
      }
  }
  </code></pre>
  
  <p>and Finally the main of prova project:</p>
  
  <pre><code>#include "stdafx.h"
  #include "optFunDll.h"
  #include &lt;iostream&gt;
  //#include "C:\Users\ANTONIO\Desktop\optDll\optDll\tool_library.h"
  
  using namespace std;
  
  
  int main()
  {
      const char *pRicette;
      pRicette=new char(NULL);
      const char *pWarehouse;
      pWarehouse=new char(NULL);
      const char *pFarmacia;
      pFarmacia=new char(NULL);
      const char *pShaker;
      pShaker=new char(NULL);
      optFun::myoptFun::GlobalOutput  total;
      optFun::myoptFun::scheduling(pRicette,pWarehouse,pFarmacia,pShaker,total);
  
      return 0;
  }
  </code></pre>
  
  <p>Thanks for your help.
  Please let me know if you want more info.</p>
  
  <p>if I comment the code lines under class definition in OptDll.cpp i get these errors:
      Error   5   error C2079: 'total' uses undefined class 'optFun::myoptFun::GlobalOutput'  c:\users\antonio\desktop\optdll\prova\prova.cpp 23</p>
  
  <pre><code>Error   6   error C2664: 'optFun::myoptFun::scheduling' : cannot convert parameter 5 from 'int' to 'optFun::myoptFun::GlobalOutput &amp;'   c:\users\antonio\desktop\optdll\prova\prova.cpp 24
  </code></pre>
  
  <p>instead if i uncomment the definition of total i obtain also:
        9 IntelliSense: incomplete type is not allowed    c:\users\antonio\desktop\optdll\optdll\optfundll.cpp    131</p>
  
  <p>Thanks for you availability, I'm new on c++ programming.</p>