小编Ced*_*sme的帖子

如何删除警告LNK4217和LNK4049

我在链接步骤上有警告.这些警告仅在发布模式下出现.

我的程序由两部分组成:一个生成.lib的库和一个使用该库的可执行文件.

当我建立图书馆时,我没有任何警告.但是当我构建我的可执行文件时,在链接上我发出警告LNK4217和LNK4049.例如:

3>DaemonCommon.lib(Exception.obj) : warning LNK4217: locally defined symbol ??0exception@std@@QAE@ABQBD@Z (public: __thiscall std::exception::exception(char const * const &)) imported in function "public: __thiscall std::bad_alloc::bad_alloc(char const *)" (??0bad_alloc@std@@QAE@PBD@Z)
3>DaemonCommon.lib(CommAnetoException.obj) : warning LNK4217: locally defined symbol ??0exception@std@@QAE@ABQBD@Z (public: __thiscall std::exception::exception(char const * const &)) imported in function "public: __thiscall std::bad_alloc::bad_alloc(char const *)" (??0bad_alloc@std@@QAE@PBD@Z)
Run Code Online (Sandbox Code Playgroud)

我在MSDN中读过,这些警告可能是由__declspec(dllimport)的声明引起的.但是,在我的lib类中,我没有像这样声明的东西.例如,这是我的类Exception:

#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 …
Run Code Online (Sandbox Code Playgroud)

c++ warnings visual-studio-2010 visual-studio

17
推荐指数
1
解决办法
3万
查看次数

用户输入日期的最佳方式是什么

对于我的应用程序,我必须从用户那里得到一个日期.

我尝试了一个简单EditText的输入类型date,但对于必须自己输入'/'角色的用户来说,这不是很方便.

我也试过这个DatePicker组件.它比它更方便,EditText但与其他组件相比它很大EditText.

有没有最好的方式让用户获得约会?

user-interface android date

3
推荐指数
1
解决办法
1663
查看次数

堆叠两个DLL之间的损坏

当我在发布模式下编译时,我在std :: string的重新分配上有堆损坏.

实际上,在一个名为DLL的DLL中Atc.dll,我调用了一个名为另一个DLL的函数Utilies.dll.在我的函数结束时Atc.dll,我有堆损坏.

我的功能在于Atc.dll:

void CoreController::readConfigXMLFile()
{
    ConfigFileManager configFileManager;
    std::string pathXmlFilesTemp = configFileManager.getPathXMLFiles();
}
Run Code Online (Sandbox Code Playgroud)

然后,这是在以下getPathXMLFiles声明的函数Utilies.dll:

std::string ConfigFileManager::getPathXMLFiles()
{
    bool err = false;
    std::string ret = "";

    if (!mParserXml.getNodeTextValue(sPathXmlFilesTag, ret))
    {
        err = true;
    }

    if (err)
    {
        ret = sPathXMLFilesDefault;
    }

    return ret;
}
Run Code Online (Sandbox Code Playgroud)

注意:如果在这里我没有调用该函数getNodeTextValue,则不会发生堆损坏.所以,有一个函数getNodeTextValue在同一个DLL中getPathXMLFiles:

bool ParseXml::getNodeTextValue(const string& path, string& nodeValue)
{
    DOMNode* child = XmlNode::getChildNodeByPath(xmlNode, path);
    //If path is valid. …
Run Code Online (Sandbox Code Playgroud)

c++ dll visual-studio-2010 visual-studio heap-corruption

2
推荐指数
1
解决办法
1852
查看次数