problem when compile with g++ and cl

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 ?
 
M

Michael DOUBEZ

marsarden a ¨¦crit :
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

I guess cl is more fashion than gcc.
Singleton hunt is open !
any one who help me out , what the correct cl command is ?
Search 'compiling a C++ program' on:
http://msdn2.microsoft.com/

This is a c++ group not an ms one.

Michael
 
M

marsarden

if this wasn't obvious this is not a c++ question per se... but
anyways here is the official discussion and resoluiton for the issuehttp://support.microsoft.com/kb/834332

thks alot!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,069
Latest member
SimplyleanKetoReviews

Latest Threads

Top