Pre-answer for questions about setting up VC++ .net 2003

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
theWolf
Knows some wx things
Knows some wx things
Posts: 43
Joined: Wed May 18, 2005 12:27 am

Pre-answer for questions about setting up VC++ .net 2003

Post by theWolf » Tue Aug 16, 2005 2:14 pm

The following is the main.cpp that I use with VC.
It's not the best but is somewhat instructive for those just starting.

(I'm using a GlCanvas for graphics.)

Comments show my project settings.

I hope some will find this helpful.

Geaux (Cajun slang for "Go" as in Go Team!) WxWidgets! :)

Code: Select all

// Name:        main
// Purpose:     WxWidgets Model main and notes for VC++ .net 2003
// Author:      theWolf

//VC++.net 2003 "Project|Properties..." (release):
//
//      C/C++|Preprocessor|Preprocessor Definitions
//	WIN32;__WXMSW__;_WINDOWS
//      C/C++|Optimization
//	Disabled (/Od)
//      C/C++|Code Generation|Runtime Library
//	Multi-threaded DLL (/MD)
//      C/C++|Precompiled Headers|Create/Use Precompiled Headers
//	Not Using Precompiled Headers
//      C/C++|General|Additional Include Directories
//	c:\wxWidgets-2.6.1\include;c:\wxWidgets-2.6.1\contrib\include;
//              c:\wxWidgets-2.6.1\lib\mswd;c:\wxWidgets-2.6.1
//                     \lib\vc_lib\mswd;

//      Linker|General|Additional Library Directories
//	c:\wxWidgets-2.6.1\lib;c:\wxWidgets-2.6.1\lib\vc_lib;
//	c:\wxWidgets-2.6.1\contrib\lib;c:\wxWidgets-2.6.1
//                      \contrib\lib\vc_lib
//      Linker|Debugging|Generate Debug Info
//	No
//      Linker|System|Subsystem
//	Windows (/SUBSYSTEM:WINDOWS)
//


//VC++.net 2003 "Project|Properties..." (debug):

//     C/C++|Preprocessor|Preprocessor Definitions
//	WIN32;__WXMSW__;_WINDOWS;_DEBUG
//     C/C++|Optimization
//	Disabled (/Od)
//     C/C++|Code Generation|Runtime Library
//	Multi-threaded DEBUG DLL (/MD)
//     C/C++|Precompiled Headers|Create/Use Precompiled Headers
//	Not Using Precompiled Headers
//     C/C++|General|Additional Include Directories
//	c:\wxWidgets-2.6.1\include;c:\wxWidgets-2.6.1\contrib\include;
//              c:\wxWidgets-2.6.1\lib\mswd;c:\wxWidgets-2.6.1
//                      \lib\vc_lib\mswd;

//     Linker|General|Additional Library Directories
//	c:\wxWidgets-2.6.1\lib;c:\wxWidgets-2.6.1\lib\vc_lib;
//	c:\wxWidgets-2.6.1\contrib\lib;c:\wxWidgets-2.6.1
//                     \contrib\lib\vc_lib
//     Linker|Debugging|Generate Debug Info
//	Yes (/DEBUG)
//     Linker|System|Subsystem
//	Windows (/SUBSYSTEM:WINDOWS)
//


#include "wx/wx.h"
#include "wx/glcanvas.h"
#include "myFrame.h"
#include "myPanel.h"
#include "myCanvas.h"
#include "mondrian.xpm"
#include "dwg.h"

// libs needed for linking
#ifdef _DEBUG

	//MS System libs
	#pragma comment(lib, "rpcrt4")
	#pragma comment(lib, "comctl32")

                //wx libs
	#pragma comment(lib, "wxbase26d")
	#pragma comment(lib, "wxmsw26d_core")
                #pragma comment(lib, "wxmsw26d_gl")

#else

	#pragma comment(lib, "comctl32")

	#pragma comment(lib, "wxbase26")
	#pragma comment(lib, "wxmsw26_core")
                #pragma comment(lib, "wxmsw26_gl")

#endif

// Other libs
//#pragma comment(lib, "rpcrt4")
//#pragma comment(lib, "wsock32")

//#pragma comment(lib, "wxmsw26_gl")
//#pragma comment(lib, "opengl32")
//#pragma comment(lib, "glu32")

//#pragma comment(lib, "wxmsw26_adv")
//#pragma comment(lib, "wxbase26_xml")
//#pragma comment(lib, "wxbase26_net")
//#pragma comment(lib, "wxexpat")
//#pragma comment(lib, "wxmsw26_html")
//#pragma comment(lib, "wxmsw")


CmyFrame*    pFrame;
CmyPanel*     pPanel;
CmyCanvas*  pCanvas;

Cdwg dwg;     //My Opengl drawing routines

// Declare the application class
class MyApp : public wxApp
{
public:
    // Called on application startup
    virtual bool OnInit();
};



// Implements MyApp& GetApp()
DECLARE_APP(MyApp)

// Give wxWidgets the means to create a MyApp object
IMPLEMENT_APP(MyApp)

// Initialize the application
bool MyApp::OnInit()
{

	SetVendorName("'Your Company Name'");
                SetAppName("'Your App Name'");

	pFrame   =   (CmyFrame*)NULL;
	pPanel   =   (CmyPanel*)NULL;
	pCanvas  =  (CmyCanvas*)NULL;

                pFrame   = new CmyFrame(wxT("Your Main Frame Title"));


	wxSize theSize =  pFrame->GetMaxSize();
                pFrame->SetSize(0,0,theSize.GetWidth(),theSize.GetHeight() );

	//pPanel = new CmyPanel();   //Not using right now

	pCanvas = new CmyCanvas
                    (pFrame,wxID_ANY,wxDefaultPosition,wxDefaultSize);

                SetTopWindow(pFrame);

                // Show it
                pFrame->Show(true);


                // Start the event loop
                return true;
}
______________
WxWidgets 2.6.1, .net 2003, Windows2000
Sometimes there's a lot of gravel around the gems. WxWidgets is a gem!

Post Reply