Implication of project dependencies

From: Aurélien REGAT-BARREL (nospam-aregatba_at_yahoo.fr.invalid)
Date: 01/03/05


Date: Mon, 3 Jan 2005 11:22:27 +0100

Hi,
Happy new year everybody.
Sorry for crossposting, but I don't know which is the best : vc.ide_general
or vsnet.ide ?
I am working on a project with VC++ 2003 and it compile & link well, but I
have a strange problem. I have a singleton class with the following static
function:

myclass & myclass::GetInstance()
{
    static myclass m;
    return m;
}

This class is compiled as a static lib and used by an other project "main"
in the same solution.
My problem is that the static keyword seems to be ignored by the compiler.
Each time I call GetInstance(), a new object is created (the constructor of
m is called). It used to work, and the only change I found which seems to be
responsible of that are the project dependencies. Before, I used to manually
add the static lib myclass.lib in the link tab of my project. Now I removed
this manual reference and checked the project myclass in the project
dependencies of my "main" project, and I have this problem.
I don't understand what is wrong.

Thanks for your help.

-- 
Aurélien REGAT-BARREL


Relevant Pages

  • Implication of project dependencies
    ... I am working on a project with VC++ 2003 and it compile & link well, ... myclass & myclass::GetInstance ... responsible of that are the project dependencies. ... this manual reference and checked the project myclass in the project ...
    (microsoft.public.vc.ide_general)
  • Re: Organising classes in C# in Visual Studio ?
    ... > Visual Studio copying the Solution to the folder that adds the MyClass? ... > don't want to compile it to a dll - I better like to have a link or ... > something to the source code file itself! ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: class template
    ... > I defined a class template and some member variables and ... > class MyClass ... compile and the exact errorthat you're getting from the compiler. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Strange problem about constructor
    ... ie: myclass{... ... Get this code to compile and show us the problem. ... >> A(int a, int b) ...
    (comp.lang.cpp)