Skip to content

NetworkInterface.cpp compile error w/ POCO_NO_WSTRING (1.5.3) #518

@xnop

Description

@xnop

Compiling NetworkInterface.cpp under Win7 with no WSTRING support

define POCO_NO_WSTRING

there are 2 issues:

1: should add include "Poco/Error.h"

if defined(POCO_OS_FAMILY_WINDOWS)

#if defined(POCO_WIN32_UTF8)
    #include "Poco/UnicodeConverter.h"
    #include "Poco/Error.h"
#else
    #include "Poco/Error.h"   // added
#endif
#include <iphlpapi.h>
#include <ipifcons.h>

endif

2: local variable rc should be defined before use in NetworkInterface::Map NetworkInterface::map()

ifdef POCO_WIN32_UTF8

    Poco::UnicodeConverter::toUTF8(pAddress->FriendlyName, name);
    Poco::UnicodeConverter::toUTF8(pAddress->Description, displayName);

else

    char nameBuffer[1024];
    int rc = WideCharToMultiByte(CP_ACP, 0, pAddress->FriendlyName, -1, nameBuffer, sizeof(nameBuffer), NULL, NULL);
    if (rc) name = nameBuffer;
    char displayNameBuffer[1024];
    rc = WideCharToMultiByte(CP_ACP, 0, pAddress->Description, -1, displayNameBuffer, sizeof(displayNameBuffer), NULL, NULL);
    if (rc) displayName = displayNameBuffer;

endif

hope this helps,
Daniel

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions