How to Build pylon C++ Applications with Free Microsoft Visual Studio

Transcription

How to Build pylon C++ Applications with Free Microsoft Visual Studio
APPLICATION NOTE
How to Build Basler pylon C++ Applications
with Free Microsoft Visual Studio
Document Number: AW000644
Version: 05 Language: 000 (English)
Release Date: 8 April 2016
INTERNAL USE ONLY
(Set it to white if you do not
need it)
Contacting Basler Support Worldwide
Europe, Middle East, Africa
Basler AG
An der Strusbek 60–62
22926 Ahrensburg
Germany
Tel. +49 4102 463 515
Fax +49 4102 463 599
[email protected]
The Americas
Basler, Inc.
855 Springdale Drive, Suite 203
Exton, PA 19341
USA
Tel. +1 610 280 0171
Fax +1 610 280 7608
[email protected]
Asia-Pacific
Basler Asia Pte. Ltd.
35 Marsiling Industrial Estate Road 3
#05–06
Singapore 739257
Tel. +65 6367 1355
Fax +65 6367 1255
[email protected]
www.baslerweb.com
All material in this publication is subject to change without notice and is copyright
Basler AG.
AW00064405000
Basler Application Note
Table of Contents
1
Introduction ..............................................................................................................................2
2
Steps to be Carried Out ..........................................................................................................3
Step 1 – Installing the Basler pylon Camera Software Suite SDK............................................3
Step 2 – Installing the Desired Free Microsoft Visual Studio Tool............................................4
Step 3 – Preparing C++ Projects...............................................................................................5
Step 4 – Running the Project ....................................................................................................7
Revision History ..............................................................................................................................8
How to Build Basler pylon C++ Applications with Free Microsoft Visual Studio
1
AW00064405000
Basler Application Note
1 Introduction
Users of the Basler pylon Camera Software Suite may want to build their own C++ applications
without the need to purchase an integrated development environment (IDE). This application note
describes an alternative way to build pylon based C++ applications using free Microsoft Visual
Studio.
Microsoft stopped providing single language programming environments. Therefore, it is
necessary to install the complete edition of free Microsoft Visual Studio. This will automatically
enable you to build pylon based C++ applications with .NET languages such as C# and Visual
Basic (*) as well, which are also supported by the Basler pylon Camera Software Suite.
The following two free Microsoft Visual Studio tools are applicable to build pylon based C++
applications:

Microsoft Visual Studio Express 2013 for Windows Desktop
Microsoft Visual Studio Express 2013 for Windows Desktop does not provide the x64 native
compiler. However, you can build 64-bit executables just fine using the x86-x64 cross compiler
running on WOW64.

Microsoft Visual Studio Community
Microsoft Visual Studio Community is the successor of the Express Edition starting with the
2015 release, but is also available in a 2013 release. It is comparable in its functionality to the
full Professional Edition.
To get an overview of the Visual C++ features available in Microsoft Visual Studio, refer to the
following link: https://msdn.microsoft.com/en-us/library/hs24szh9(v=vs.120).aspx.
Choose the tool that best suits your needs.
(*) The pylon SDK for Visual Basic 6 is no longer included since pylon v4.1.0.
How to Build Basler pylon C++ Applications with Free Microsoft Visual Studio
2
AW00064405000
Basler Application Note
2 Steps to be Carried Out
To build powerful Windows pylon applications carry out the following steps:
1. Install the Basler pylon Camera Software Suite SDK.
2. Install the desired free Microsoft Visual Studio tool.
3. Prepare the C++ projects.
4. Run the project.
In the following, these steps are described in detail.
Step 1 – Installing the Basler pylon Camera Software Suite SDK
1. Download the desired or current version of the Basler pylon Camera Software Suite from the
Basler website: www.baslerweb.com



Basler pylon 5 Camera Software Suite for Windows
Basler pylon 4 Camera Software Suite for Windows 32 bit
Basler pylon 4 Camera Software Suite for Windows 64 bit
2. Install the Basler pylon Camera Software Suite.


pylon 4: Enable the pylon SDK for C++ option.
pylon 5: Enable the SDKs option.
pylon 4
pylon 5
Figure 1: Installation Process – Enabled pylon SDK for C++ Option
For detailed information about installing the Basler pylon 5 Camera Software Suite and your
Basler camera, see the Installation and Setup Guide for Cameras Used with pylon for Windows
(AW000611). You can download the guide from the Basler website:
www.baslerweb.com
If you need any assistance in using the SDK, please contact your local
Basler Customer Service team.
How to Build Basler pylon C++ Applications with Free Microsoft Visual Studio
3
AW00064405000
Basler Application Note
Step 2 – Installing the Desired Free Microsoft Visual Studio Tool
1. Be ready to have a Microsoft account registration (email address and password).
The Free Microsoft Studio IDE applications are free developer tools for single users and small
commercial teams. To download and use them longer than the trial period, a Microsoft account
is requested that is easily and free available through registration with a valid email address.
2. Download the desired free Microsoft Visual Studio tool:


Microsoft Visual Studio Express 2013 for Windows Desktop or
Microsoft Visual Studio Community
Refer to the following download link (**) for more information:
All Multilanguage: Install & ISO
https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs
(**) This link may become invalid over time, so we don’t guarantee its availability.
System Requirements – Supported Operating Systems




Windows 7 SP1 (x86 and x64)
Windows 8 (x86 and x64)
Windows 8.1 (x86 and x64)
Windows 10 (x86 and x64)
The following operating systems have not been tested with the Basler pylon Camera Software
Suite. Full functionality is likely to be provided, but can't be ensured.



Windows Server 2008 R2 SP1 (x64)
Windows Server 2012 (x64)
Windows Server 2012 R2 (x64)
Hardware Requirements





1.6 GHz or faster processor
1 GB of RAM (1.5 GB if running on a virtual machine)
5 GB of available hard disk space
5400 RPM hard drive
DirectX 9-capable video card running at 1024 x 768 or higher display resolution
Additional Requirements

This version of Microsoft Visual Studio works best with Internet Explorer 10 or higher. If
Internet Explorer 10 is not installed on your computer, some features might not work as
expected.
How to Build Basler pylon C++ Applications with Free Microsoft Visual Studio
4
AW00064405000

Basler Application Note
On Windows 8.1 and Windows Server 2012 R2, KB2883200 (available through Windows
update) is required.
3. Install your downloaded product and register it with your account.
At the end of the installation procedure, you will be requested to register your product. You
must register the product free of charge within 30 days. If not, it will stop working at the end of
the 30-day period.
Eventually, you will be given a 14-digit number registration key. You need the key to register
and to continue using the free Microsoft Visual Studio tool beyond the initial 30-day period.
Step 3 – Preparing C++ Projects
There are several sample projects available within the Basler pylon Camera Software Suite SDK
installation. Depending on the pylon version, they are e.g. located under:
C:\Program Files\Basler\pylon 5\Development\Samples\C++
C:\Program Files\Basler\pylon 4\Samples\C++
The available solution files (*.sln) are created with former Microsoft Visual Studio releases to keep
a certain backwards compatibility. However, they are unidirectional upgradable when being
opened. The advantage of using the existing solution files is that all necessary project settings are
pre-configured.
No matter whether you want to start your own project from scratch or begin adding pylon support
to existing projects, there are a few things to consider. Please refer to the pylon documentation
files, which include some information on how to set up the IDE for pylon use.
The pylon documentation files will be installed with the pylon SDK. Depending on the pylon
version, they are e.g. located under:
C:\Program Files\Basler\pylon 5\Development\Doc\PylonCppSDK.chm
C:\Program Files\Basler\pylon 4\doc\PylonCppSDK.chm
Please refer to the following sections for more information:


Programmer's Guide: Common Settings for Building Applications with pylon
Advanced Topics: Settings for Building Applications with pylon
IDE Settings
1. To configure the C/C++ compiler, add the following include directories for Release and Debug
project configurations.
How to Build Basler pylon C++ Applications with Free Microsoft Visual Studio
5
AW00064405000
Basler Application Note
Figure 2: Settings for Configuring the C/C++ Compiler (pylon 5)


pylon 4: $(PYLON_ROOT)\include;$(PYLON_GENICAM_ROOT)\library\CPP\include
pylon 5: $(PYLON_DEV_DIR)\include
2. To configure the linker, add the following library directories for Release and Debug project
configurations.
Figure 3: Settings for Configuring the Linker (pylon 5)




pylon 4: $(PYLON_ROOT)\lib\Win32;$(PYLON_GENICAM_ROOT)\library\CPP\Lib\Win32_i86
pylon 4: $(PYLON_ROOT)\lib\Win64;$(PYLON_GENICAM_ROOT)\library\CPP\Lib\Win64_x64
pylon 5: $(PYLON_DEV_DIR)\lib\Win32
pylon 5: $(PYLON_DEV_DIR)\lib\x64
3. Enable the run-time type information for Release and Debug project configurations.
Figure 4: Enabling the Run-Time Type Information (pylon 5)
How to Build Basler pylon C++ Applications with Free Microsoft Visual Studio
6
AW00064405000
Basler Application Note
Step 4 – Running the Project

If you want to use a pylon SDK sample, simply click the Start button in the IDE or press F5.
Your pylon sample program should build and run.

If you want to start a new x86 project, open Microsoft Visual Studio Express 2013 for Windows
Desktop or Microsoft Visual Studio Community and proceed as follows:
1. In the File menu click New Project.
2. In the New Project dialog expand the Visual C++ node in the Product Types tree.
Figure 5: New Project Dialog
3. Click on the Win32 Application template, give your project a name, and click OK.
4. In the Win32 Application Wizard dialog box, make sure that Windows application is
selected as application type and that ATL is not selected.
5. Consider the information described in Step 3 – Preparing C++ Projects.
6. Click the Finish button to generate the project.
7. Test your project by clicking the Start button in the IDE or by pressing F5.
Your Win32 application should build and run.

If you want to create an x64 project, the same procedure is still valid. However, the linked
pylon folders to binary files have to be adapted.
To change the platform:
1. In the Build menu click Configuration Manager.
2. In the Configuration Manager dialog open the Active solution platform drop down list
and select <New…>.
3. In the New Solution Platform dialog open the Type or select the new platform drop
down list, select x64 and click OK.
How to Build Basler pylon C++ Applications with Free Microsoft Visual Studio
7
AW00064405000
Basler Application Note
Revision History
Document Number
Date
Changes
AW00064401000
1 Apr 2008
Initial release version of this document.
AW00064402000
30 Jul 2008
Updated contact addresses and phone numbers.
AW00064403000
23 Jul 2015
Update due to new underlying software releases.
Revision of the entire document.
AW00064404000
29 Jan 2016
Added Windows 10 (x86 and x64) as supported
operating system (see page 4).
Added information that the support of the mentioned
Windows Servers is not guaranteed (see page 4).
AW00064405000
8 Apr 2016
Added pylon 5 IDE settings.
Updated screenshots with corresponding pylon 5
settings.
How to Build Basler pylon C++ Applications with Free Microsoft Visual Studio
8