[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

[C++] linker fejl



Hej
Under min lille Singleton implementation får jeg følgende
fejlbesked - hvad betyder det...?

sslug@sslug g++ singleton.cpp -o singleton
/tmp/ccHsL5JZ.o(.text+0x29): In function `Singleton::Instance()':
: undefined reference to `Singleton::Singleton[in-charge]()'
collect2: ld returned 1 exit status

som jeg får hvor singleton.cpp ser således ud:
-------------------------------------------

#include <iostream>
using namespace std;

class Singleton {
public:
  static Singleton* Instance();
private:
  static Singleton* _singleton;
  Singleton();
};

Singleton* Singleton::_singleton = 0;

Singleton* Singleton::Instance()
{
   if (_singleton == 0) _singleton = new Singleton;
   return _singleton;
}

int main (void){
  cerr << "test" << endl;
  Singleton * ms;
  ms = Singleton::Instance();
  return 0;
}


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:44 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *