Home > Support > ASN1C Tutorial

ASN1C Tutorial

Creating a Project

This tutorial will help guide you to complete a Microsoft Visual C++ 6.0 project. The results will enable to build and run the files generated by the ASN1C compiler.


Note: Before you begin to create a project, it is necessary to have first generated the .c / .cpp and .h using the ASN1C GUI or command line.

Open Microsoft Visual C++ .

From the File menu, select select the New option.

A new window will appear on your screen enabling you to create a new workspace, project, or document.

Select the Project tab from the top of the new window.

Select Win 32 Console Application from the list and proceed with project creation wizard.

Enter VSproj for the Project name, and Click the OK button. From the next window, ensure you Create a Blank Project is selected and click Finish.
Once you click the Finish button in the wizard, you will return to the original Visual C++ window.

Once you return to the main window, add the appropriate files to the project.

To add files to a project, select the Project option from the menu. From the pop-up menu, select Add to Project followed by selecting Files from the next pop-up menu. At this point a new window will appear. From this window, select the .c, .cpp, and .h files generated by the ASN1C compiler. For example, select employee.c and employee.h which have been compiled by the ASN1C compiler. When you have selected all of these files, click on the OK button.
NOTE: It is necessary to add both the .c or .cpp file AND the .h file.

From the Project menu, select the Settings option.

This will open a new window allowing you to alter the setting of the current project.

Select the Link tab from the top of the Project Settings window.

Add asn1rt.lib and and one of the following libraries to the Object/library modules text area. Once complete, select OK.

  • asn1BER.lib (if BER or DER encoding rules were selected)
  • asn1PER.lib (if PER encoding rules were selected)
  • asn1XER.lib (if XER encoding rules were selected)

From the Tools menu, select Options.

This will open a new window allowing you to modify the options of your project.

Inside the Directories tab, ensure you are viewing the directories of the Include files

Add C:\ACV58x\RTSRC and one of the following directories to the list of directories:

  • C:\ACV58x\RTBERSRC (if BER or DER encoding rules were selected)
  • C:\ACV58x\RTPERSRC (if PER encoding rules were selected)
  • C:\ACV58x\RTXERSRC (if XER encoding rules were selected)

and the directory of the the library files.

Add C:\ACV58x\c\lib if your sample application is a in C
or C:\ACV58x\cpp\lib if your sample application is a in C++.

NOTE: x is the version number of your ASN1C compiler.

You can now Build and Compile the code.

  • Select Build form the Build menu option.
  • Select Compile from the Build menu option.