M
marsarden
when i compile a cpp file using microsoft cl (version 13.10.3077) ,
error occurs:
singleton.h : fatal error LNK1106: invalid file or disk full: cannot
seek to 0x6D75
the command line is : cl test.cpp singleton.h -o test.exe
but ,when i using g++ on linux system , it's ok. the command line is :
g++ test.cpp singleton.h -o test
the file :
//test.cpp
#include "singleton.h"
int main(void)
{
Singleton s;
s.instance()->fun();
s.instance()->fun();
return 0;
}
//singleton.h
#include <iostream>
using namespace std;
class Singleton
{
public:
Singleton()
{
}
static Singleton* instance()
{
static Singleton* instance_;
if(!instance_)
instance_=new Singleton();
return instance_;
}
void fun(){cout<<"instance call"<<endl;}
};
any one who help me out , what the correct cl command is ?
error occurs:
singleton.h : fatal error LNK1106: invalid file or disk full: cannot
seek to 0x6D75
the command line is : cl test.cpp singleton.h -o test.exe
but ,when i using g++ on linux system , it's ok. the command line is :
g++ test.cpp singleton.h -o test
the file :
//test.cpp
#include "singleton.h"
int main(void)
{
Singleton s;
s.instance()->fun();
s.instance()->fun();
return 0;
}
//singleton.h
#include <iostream>
using namespace std;
class Singleton
{
public:
Singleton()
{
}
static Singleton* instance()
{
static Singleton* instance_;
if(!instance_)
instance_=new Singleton();
return instance_;
}
void fun(){cout<<"instance call"<<endl;}
};
any one who help me out , what the correct cl command is ?