简体   繁体   中英

VS2005 C++: strange linking problem

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

如果从calcWeight的声明和定义中删除“内联”会怎样?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM