简体   繁体   English

将#include“ GL / freeglut.h”添加到C ++ wxWidgets代码CodeBlocks中时,会生成生成错误

[英]#include “GL/freeglut.h” produces build errors when adding it to C++ wxWidgets code, CodeBlocks

I am trying to write an application that includes both wxWidgets and OpenGL ( FreeGLUT & GLEW ). 我正在尝试编写一个包含wxWidgets和OpenGL(FreeGLUT&GLEW)的应用程序。 I am using CodeBlocks & C++ on a Win 7 machine. 我在Win 7机器上使用CodeBlocks&C ++。 So far I have written some wxWidgets code that builds and works properly. 到目前为止,我已经编写了一些wxWidgets代码,这些代码可以正常构建和运行。 But when I add the line : 但是当我添加以下行时:

#include "GL/freeglut.h"

The program doesn't build properly and I get these errors ( in winundef.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)'|

What is the reason for this problem and how to solve it ? 此问题的原因是什么,如何解决?

The solution was moving 解决方案在移动

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

after wxWidgets header files. 在wxWidgets头文件之后。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM