首页 > 解决方案 > Visual C++ LNK2028 和 LNK2019 错误

问题描述

这是我试图在 Visual Studio 2017 中编译的代码。

#include "stdafx.h"
#define _WINSOCKAPI_
#include <httpserv.h>
#include "json.h"
#include "json-forwards.h"
#include <iostream>
#include <fstream>

HRESULT
__stdcall
RegisterModule(DWORD dwServerVersion, IHttpModuleRegistrationInfo * pModuleInfo, IHttpServer * pGlobalInfo)
{
    UNREFERENCED_PARAMETER(dwServerVersion);
    UNREFERENCED_PARAMETER(pGlobalInfo);

    bool alive = true;

    MyGlobalModule * pGlobalModule = new MyGlobalModule;

    if (NULL == pGlobalModule)
    {
        return HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY);
    }

    while (alive) {
        Json::Reader reader;
        Json::Value root;
        std::ifstream push_manifest("push_manifest.json", std::ifstream::binary);
        bool parsingSuccessful = reader.parse(push_manifest, root, false);

        if (!parsingSuccessful)
        {
            // report to the user the failure and their locations in the document.
            std::cout << reader.getFormatedErrorMessages()
                << "\n";
        }

        std::string encoding = root.get("encoding", "UTF-8").asString();
        std::cout << encoding << "\n";
        alive = false;
    }

    return pModuleInfo->SetGlobalNotifications(
        pGlobalModule, GL_PRE_BEGIN_REQUEST);
}

编译时出现以下错误。请提出错误,因为错误没有解释任何内容。

Visual Studio 编译错误

标签: c++

解决方案


推荐阅读