开发者

VS2005 C++: strange linking problem

开发者 https://www.devze.com 2022-12-25 21:31 出处:网络
I have some strange linking problem in my Visual Studio 2005 C++ project. As always, I declare class in a header and define it\'s methods in cpp. A have all these files included in my project.

I have some strange linking problem in my Visual Studio 2005 C++ project. As always, I declare class in a header and define it's methods in cpp. A have all these files included in my project. And I still have the unresolved external symbol calcWeight. It appears if I actually use this class in my main function. calcWeight() is declared as virtual in the parent class CHDRGenerator If I comment a code in cpp and define calcWeight in a class body, it works fine. But i really don't like this magic. Can someone help?

Here is the part of a code:

//mann-开发者_开发知识库pickard.h
#include "stdafx.h"
#include "simple.h"

class CHDRGenerator_Mann_Pickard : public CHDRGenerator
{
public:
    /// @name Constructors
    /// @{
    /// @brief a constructor using prepared imaged sequence
    CHDRGenerator_Mann_Pickard(CSimpleImageFile * imSeq, int seqL) : CHDRGenerator(imSeq, seqL)
    {
    }

    /// @brief a constructor using filenames
    CHDRGenerator_Mann_Pickard(std::string * filenames, int seqL) : CHDRGenerator(filenames, seqL)
    {
    }

    /// @brief a constructor, CFileNameSequence object parameter
    CHDRGenerator_Mann_Pickard(CFileNameSequence & const fileseq) : CHDRGenerator(fileseq)
    {
    }
    /// @}

private:
    inline double calcWeight(double val);
};


//mann-pickard.cpp  
#include "mann-pickard.h"
//=======================Class CHDRGenerator_Mann_Pickard methods=====================//

//...

inline double CHDRGenerator_Mann_Pickard::calcWeight(double val)
{
    const double gamma = 2.2f;
    return gamma * pow(val, gamma - 1);
}
//=====================End of Class CHDRGenerator_Mann_Pickard methods=================//

"simple.h" is a header with CHDRGenerator class implementation. I know it should work...as it always worked. Maybe I have some stupid hard-to-find mistake?..


What happens if you remove "inline" from your declaration and definition of calcWeight?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号