【问题标题】:#include "GL/freeglut.h" produces build errors when adding it to C++ wxWidgets code, CodeBlocks#include "GL/freeglut.h" 在将其添加到 C++ wxWidgets 代码、CodeBlocks 时会产生构建错误
【发布时间】:2014-08-14 23:41:16
【问题描述】:

我正在尝试编写一个同时包含 wxWidgets 和 OpenGL ( FreeGLUT & GLEW ) 的应用程序。我在 Win 7 机器上使用 CodeBlocks & C++。到目前为止,我已经编写了一些构建和正常工作的 wxWidgets 代码。但是当我添加该行时:

#include "GL/freeglut.h"

程序没有正确构建,我收到这些错误(在 winundef.h 中):

O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h||In function 'HWND__* CreateDialog(HINSTANCE, LPCTSTR, HWND, DLGPROC)':|
O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h|38|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HWND__* CreateDialogParamW(HINSTANCE, LPCWSTR, HWND, DLGPROC, LPARAM)'|
O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h||In function 'HFONT__* CreateFont(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCTSTR)':|
O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h|69|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '14' to 'HFONT__* CreateFontW(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCWSTR)'|
O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h||In function 'HWND__* CreateWindow(LPCTSTR, LPCTSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID)':|
O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h|94|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HWND__* CreateWindowExW(DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID)'|
O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h||In function 'HMENU__* LoadMenu(HINSTANCE, LPCTSTR)':|
O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h|111|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HMENU__* LoadMenuW(HINSTANCE, LPCWSTR)'|
O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h||In function 'HICON__* LoadIcon(HINSTANCE, LPCTSTR)':|
O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h|311|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HICON__* LoadIconW(HINSTANCE, LPCWSTR)'|
O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h||In function 'HBITMAP__* LoadBitmap(HINSTANCE, LPCTSTR)':|
O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h|324|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HBITMAP__* LoadBitmapW(HINSTANCE, LPCWSTR)'|

这个问题的原因是什么以及如何解决?

【问题讨论】:

    标签: c++ opengl include wxwidgets freeglut


    【解决方案1】:

    解决方案正在移动

    #include "GL/glew.h"
    #include "GL/freeglut.h"
    

    在 wxWidgets 头文件之后。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-12-30
      • 2016-08-14
      • 2019-10-28
      • 1970-01-01
      • 1970-01-01
      • 2017-11-15
      • 2018-09-16
      相关资源
      最近更新 更多