Hello,
please help me, I have a strange problem which i can't sort out in any way.
Premise: I'm using visual c++ 2005 on windows 7 x64, and I'm sure that my code isn't fatally flawed because with g++ under Linux it runs nicely.
I am developing an application which uses a static library also developed by me.
In the link phase of the application i get two mysterious LNK2019 errors.
This is the header of one of the classes of the library:
namespace sulfur
{
class Quark
{
public:
... various methods
void addAccel(const Vec2 &a);
... various methods
private:
... various data
};
}
Obviously in the cpp file i provide an implementation for addAccel with exactly the same signature.
When I try to link the application with the library, ALL the other member functions are found, except for addAccel.
The linker searches for the symbol "?addAccel@Quark@@QAEXABV?$TemplateVec2@M@Atlax@@@Z"
while in the .lib file there is (which i found using dumpbin) "?addAccel@Quark@sulfur@@QAEXABV?$TemplateVec2@M@Atlax@@@Z". The only difference here is that the linker searches for a mangled name without the namespace part and I don't know why.
I've tried to change name, position, calling convention and signature of the metod but to no avail, always getting the same error.
The second error is very similar. I have another header in the library:
namespace sulfur
{
class Cluster
{
...
Quark *addQuark(sulfur::Feature feat, float x, float y, float m=0.1f, float aF=0.01f);
...
};
}
and a correct implementation file is provided. Like before, all the other methods are linked properly, but not addQuark.
The linker searches for "?addQuark@Cluster@sulfur@@QAEPAVQuark@@W4Feature@2@MMMM@Z"
but in the library there is "?addQuark@Cluster@sulfur@@QAEPAVQuark@2@W4Feature@2@MMMM@Z".
This time the difference is the absence of the first '2' between the '@' in the version which the compiler searches for.
This isn't the first time that I build this application with visual studio and it has always linked ok except for this time with the last changes.
I don't have any clue, thank you in advance