मुझे लिंक चरण पर चेतावनियां हैं। ये चेतावनियां केवल रिलीज मोड में दिखाई देती हैं।चेतावनियों को कैसे हटाएं LNK4217 और LNK4049
मेरा प्रोग्राम दो भागों से बना है: एक पुस्तकालय जो .lib उत्पन्न करता है और एक निष्पादन योग्य जो इस लाइब्रेरी का उपयोग करता है।
जब मैं पुस्तकालय बनाता हूं तो मुझे कोई चेतावनी नहीं है। लेकिन जब मैं अपना निष्पादन योग्य बनाता हूं, लिंक पर मुझे एलएनके 4217 और एलएनके 4049 चेतावनियां हैं। उदाहरण के लिए:
3>DaemonCommon.lib(Exception.obj) : warning LNK4217: locally defined symbol [email protected]@@[email protected]@Z (public: __thiscall std::exception::exception(char const * const &)) imported in function "public: __thiscall std::bad_alloc::bad_alloc(char const *)" ([email protected]@@[email protected]@Z)
3>DaemonCommon.lib(CommAnetoException.obj) : warning LNK4217: locally defined symbol [email protected]@@QAE[email protected]@Z (public: __thiscall std::exception::exception(char const * const &)) imported in function "public: __thiscall std::bad_alloc::bad_alloc(char const *)" ([email protected]@@[email protected]@Z)
मैं MSDN में पढ़ा है, इन चेतावनियों __declspec (dllimport) की घोषणा की वजह से हो सकता है। लेकिन, मेरे मुक्ति के मेरे वर्गों में, मैंने इस तरह की चीजों को घोषित नहीं किया है।
#ifndef _EXCEPTION_HPP__
#define _EXCEPTION_HPP__
#include <string>
namespace Exception
{
class Exception
{
public:
// Constructor by default
Exception();
// Constructor parametrized
Exception(std::string& strMessage);
// Get the message of the exception
virtual std::string getMessage() const;
// Destructor
virtual ~Exception();
protected:
// String containing the message of the exception
std::string mStrMessage;
};
}
#endif
किसी मुझे बता सकते हैं क्यों इन चेतावनियों दिखाई देते हैं और उन्हें कैसे नष्ट करने के लिए: उदाहरण के लिए, यहाँ मेरी कक्षा अपवाद है?
वास्तव में, ऐसा इसलिए था क्योंकि मेरी निष्पादन योग्य परियोजना को "बहु थ्रेडेड \ एमटी" के बजाय "बहु थ्रेडेड डीएलएल \ एमडी" पर परिभाषित किया गया था ... मुझे नहीं पता क्यों। .. इसलिए आपका धन्यवाद ;-) – Cedekasme