Example compiler error C2065

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
sdaasda
Earned a small fee
Earned a small fee
Posts: 13
Joined: Sun Apr 03, 2016 10:25 pm

Example compiler error C2065

Post by sdaasda »

guys, follow the instructions on the official resource - compiled wxWidget
compile an example, the trailing compilation error.
Error:

Code: Select all

1>------ Build started: Project: app, Configuration: Debug Win32 ------
1>  Main.cpp
1>c:\boo\wxwidgets-3.1.0\include\wx\msw\private.h(1050): error C2065: 'WS_EX_LAYOUTRTL' : undeclared identifier
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
that can be? (sorry I do not speak English. Is that a little).
User avatar
doublemax
Moderator
Moderator
Posts: 19103
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Example compiler error C2065

Post by doublemax »

WS_EX_LAYOUTRTL should be in a Windows header. Maybe you have a wrong order of include files. Can you show the code?
Use the source, Luke!
sdaasda
Earned a small fee
Earned a small fee
Posts: 13
Joined: Sun Apr 03, 2016 10:25 pm

Re: Example compiler error C2065

Post by sdaasda »

Please:

Code: Select all

#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif

class MyApp : public wxApp
{
public:
	virtual bool OnInit();
};
class MyFrame : public wxFrame
{
public:
	MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
private:
	void OnHello(wxCommandEvent& event);
	void OnExit(wxCommandEvent& event);
	void OnAbout(wxCommandEvent& event);
	wxDECLARE_EVENT_TABLE();
};
enum
{
	ID_Hello = 1
};
wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(ID_Hello, MyFrame::OnHello)
EVT_MENU(wxID_EXIT, MyFrame::OnExit)
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
wxEND_EVENT_TABLE()
wxIMPLEMENT_APP(MyApp);
bool MyApp::OnInit()
{
	MyFrame *frame = new MyFrame("Hello World", wxPoint(50, 50), wxSize(450, 340));
	frame->Show(true);
	return true;
}
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
	: wxFrame(NULL, wxID_ANY, title, pos, size)
{
	wxMenu *menuFile = new wxMenu;
	menuFile->Append(ID_Hello, "&Hello...\tCtrl-H", "Help string shown in status bar for this menu item");
	menuFile->AppendSeparator();
	menuFile->Append(wxID_EXIT);
	wxMenu *menuHelp = new wxMenu;
	menuHelp->Append(wxID_ABOUT);
	wxMenuBar *menuBar = new wxMenuBar;
	menuBar->Append(menuFile, "&File");
	menuBar->Append(menuHelp, "&Help");
	SetMenuBar(menuBar);
	CreateStatusBar();
	SetStatusText("Welcome to wxWidgets!");
}
void MyFrame::OnExit(wxCommandEvent& event)
{
	Close(true);
}
void MyFrame::OnAbout(wxCommandEvent& event)
{
	wxMessageBox("This is a wxWidgets Hello world sample", "About Hello World", wxOK | wxICON_INFORMATION);
}
void MyFrame::OnHello(wxCommandEvent& event)
{
	wxLogMessage("Hello world from wxWidgets!");
}
additionally: I do not use precompilation header
User avatar
doublemax
Moderator
Moderator
Posts: 19103
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Example compiler error C2065

Post by doublemax »

This looks like Visual Studio. Did you create a new project from scratch?

If yes, start with the "minimal" sample that comes with wxWidgets first. It has VS project files where all include/library path, preprocessor symbols etc. are set correctly.

This should build out of the box.
Use the source, Luke!
sdaasda
Earned a small fee
Earned a small fee
Posts: 13
Joined: Sun Apr 03, 2016 10:25 pm

Re: Example compiler error C2065

Post by sdaasda »

Thanks you. I copied the connection string, adding a file #include <wx/window.h>
compiled program.
MidichlorianMaster
In need of some credit
In need of some credit
Posts: 1
Joined: Sat May 14, 2016 6:50 pm

Re: Example compiler error C2065

Post by MidichlorianMaster »

What connection string are you talking about because i am having the exact same problem as you and have no idea how to resolve it.
wxray
In need of some credit
In need of some credit
Posts: 1
Joined: Mon Aug 17, 2015 9:47 am

Re: Example compiler error C2065

Post by wxray »

I just ported my project to 3.1 and encountered the same problem. I fixed it by specifying WINVER=0X0500 in the "Preprocessor Definitions" section
diswantsho
In need of some credit
In need of some credit
Posts: 6
Joined: Sun Apr 26, 2015 10:11 am

Re: Example compiler error C2065

Post by diswantsho »

I opened an existing 3.0.0 project with 3.1.1 and got the same error.
WINVER=0X0500 in the "Preprocessor Definitions" also fixed it for me - there was an existing WINVER=0X0400
Post Reply