OWLNext Home

~ Setting Visual C++ 2005/2008 to work with OWLNext ~


Home
About OWLNext
Getting started
Prerequisites
Patching
Building
Configuring
Tutorials
Documentation
Downloads
Articles
Links
Discussions

Hosted by
Get OWL Next at SourceForge.net. Fast, secure and Free Open Source software downloads

Setting up environment variables

For building OWLNext applications I recommend to set the environment variable OWLROOT to point to the root folder where OWLNext files are installed. An advantage of using this environment variable is that projects are easily transferred from one computer to another without having to modify the project files.
See also: Setting up environment variables under Windows 2000/XP.
Note: OWLROOT should be set by OWLNext Setup Wizard.

Setting up directories for Visual C++ 2005/2008

If you plan to work often on OWLNext applications, it is convenient to add OWLNext include and library directories to the global Visual Studio settings.
From the menu Tools->Options open the Options dialog, and go to the Projects and Solution/VC++ Directories section. In the "Show directories for:" combo box select "Include files" and add "$(owlroot)\include":
Include Directories

Select "Library files" and add "$(owlroot)\lib":
Library Directories

This will make OWLNext include and library directories available for all Visual C++ projects.

Starting a new OWLNext project

Create a new Visual C++ Win32 application project:
New Application

In the second page of the Win32 Application Wizard, check "Empty project":
Application Wizard

If you want to link the dynamic OWLNext libraries, make sure that _OWLDLL is defined in the Preprocessor Definitions in the project options. For more information, see Configuring Visual C++ OWLNext projects.

If you have the sources of an OWL/OWLNext application that you want to convert to Visual C++, you can now add it's sources to the project.
If you want to create a new application, you may start with adding a new file named main.cpp to the project and placing in it the following code:


#include <owl/applicat.h>
#include <owl/framewin.h>

class TOWLNextApp : public TApplication
{
  public:
    TOWLNextApp() : TApplication() {}

    void InitMainWindow()
    {
        SetMainWindow(new TFrameWindow(0, _T("Sample ObjectWindows Program")));
    }
};

int
OwlMain(int /* argc */, TCHAR* /* argv */ [])
{
  return TOWLNextApp().Run();
}
Build and run the application. If you receive a linker error
Error	1	error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup	MSVCRTD.lib	OWLNextApp
then you are trying to build an Unicode application, and you have to either change the application to Single Byte or MBCS, or to change the entry point to wWinMainCRTStartup. See this link for more information.

For a walkthrough how to configure a Visual C++ project to build an OWLNext application with different settings, read this article



Last updated: 17 August 2009