Tag Archives: #Compilation error

error LNK2019: Unresolvable external symbols “__declspec(dllimport) public: int __thiscall QString::toWCharArray(wchar_t

Problem: Compiling poppler-0.42.0\qt4 on win10 with cmake and vs2010 reports the following error.

2>poppler-document.obj : error LNK2019: Unresolvable external symbol “__declspec(dllimport) public: int __thiscall QString::toWCharArray(wchar_t *)const ” (__imp _?toWCharArray@QString@@@QBEHPA_W@Z), the symbol in the function “public: __thiscall Poppler::DocumentData::DocumentData(class QString const &,class GooString * ,class GooString *)” (? ? 0DocumentData@Poppler@@QAE@ABVQString@@@PAVGooString@@1@Z) is referenced in

Reason: The Qt library itself compiles with /Zc:wchar_t- , if your program compiles with /Zc:wchar_t it will cause the compiler to have different rules for adapting function names
Whichever one it is, consistency is good.

Solution: Project – Properties – C/C++ – Language, Set wchar_t as a built-in type and change it to match the Qt library

[Solved] Error c2226: syntax error: unexpected ‘lpstr’ type

Question:

1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(6132): warning C4229: used mnemonic error: ignore modifier on data
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(6133): error C2226: syntax error : unexpected “LPSTR” type

Cause: Windows.h contains tchar.h and strsafe.h before Windows.h

Solution: Comment out the statement that contains tchar.h and strsafe.h before Windows.h.

[Solved] Fatal error C1083: unable to open include file: ‘d3dx9.h’

1. First confirm in the control panel whether to install Microsoft DirectX SDK (June 2010), if no you can go to https://www.microsoft.com/en-us/download/details.aspx?id=6812 to download.

After installation d3dx9.h file in: D:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include

2. Set the path.

Project — Properties — c/c++ — General — Additional header files (the first line is) enter here which file you are located in the directory, multiple directories separated by a semicolon, that is, enter: D:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86\Include

[Solved] fatal error C1083: Could Not Open Unable to open include file:“stdint.h”: No such file or directory

The stdint.h file is a standard header file for C99, which is not supported by vs2008 by default, so you will definitely encounter the problem of “No such file or directory” in the process of using it.

Solution: Download stdint.h or make a copy from vs2010 and put it under Program Files (x86)\Microsoft Visual Studio 9.0\VC\include path

[Solved] error: ‘xcb_generic_event_t’ was not declared in this scope

code:

bool tray::nativeEventFilter(const QByteArray &eventType, void *message, long *)
{
    qDebug("tray::nativeEventFilter:%s\n", eventType.data());
    if (eventType == "xcb_generic_event_t") {
        xcb_generic_event_t* ev = static_cast<xcb_generic_event_t *>(message);
        // ...
    }
    return false;
}

Tag Page: /home/test/Downloads/tray/tray/tray.cpp:244: error: unknown type name ‘xcb_generic_event_t’
Outcome:
../tray/tray.cpp:244:9: error: ‘xcb_generic_event_t’ was not declared in this scope
xcb_generic_event_t* ev = static_cast<xcb_generic_event_t *>(message);
^~~~~~~~~~~~~~~~~~~
../tray/tray.cpp:244:9: note: suggested alternative: ‘xGenericEvent’
xcb_generic_event_t* ev = static_cast<xcb_generic_event_t *>(message);
^~~~~~~~~~~~~~~~~~~
xGenericEvent
Solution: #include <xcb/xcb.h>
Reference: https://codesearch.isocpp.org/actcd19/main/c/clementine/clementine_1.3.1+git609-g623a53681+dfsg-1/3rdparty/qxt/qxtglobalshortcut_x11.cpp