How do I set up Microsoft Visual C++ 6.0 to compile EMA programs?

Categories:
Solution Number:
S20291
Last Modified:
2013-07-06
Issue

How do I set up Microsoft Visual C++ 6.0 to compile EMA programs? I realize I could use the op_mkema utility to do this, but prefer to work from within Visual Studio.

Solution

It is possible to make Microsoft Visual C++ 6.0 compile EMA programs directly without the use of op_mkema.  When following the instructions below, we recommend that you copy-and-paste values directly to avoid common typos that may be difficult to diagnose.

1. Create a new project.
A. Select File->New.
B. Click on the Projects tab.
C. Select Win32 Console Application in the left-hand panel.
D. Enter a name for your project in the Project name field.  Your EMA program will later be named '<project-name>.exe'.
E. Specify the location for storing your project in the Location field.
F. Click OK.
G. When prompted for the kind of console application you would like to create, select An empty project.
H. Click OK to create the project.

2. Configure the project's C\C++ settings.
A. Select Project->Settings.
B. Click on the C/C++ tab.
C. In the Category pull-down menu, select General.
D. Set the Warning level to Level 3, or higher if desired.
E. Make sure Generate browse info is selected.
F. Set Debug info to Program Database for Edit and Continue.
G. Change the Category pull-down menu to C++ Language.
H. Make sure Enable exception handling is checked.
I. Change the Category pull-down menu to Customize.
J. Make sure Suppress startup banner and information messages is selected.
K. Change the Category pull-down menu to Preprocessor.
L. Change the Preprocessor definitions to the following; (Note: If you are using C++ in your EMA program, you should remove the second argument __STDC__.)

_WINDOWS,__STDC__,HOST_PC_INTEL_WIN32,_CTYPE_DISABLE_MACROS,_X86_,WIN32,WIN32_LEAN_AND_MEAN,NOGDICAPMASKS,

NOVIRTUALKEYCODES,NOWINMESSAGES,NOWINSTYLES,NOSYSMETRICS,NOMENUS,NOICONS,NOKEYSTATES,NOSYSCOMMANDS,

NORASTEROPS,NOSHOWWINDOW,OEMRESOURCE,NOATOM,NOCLIPBOARD,NOCOLOR,NOCTLMGR,NODRAWTEXT,NOGDI,NOKERNEL,

NOUSER,NONLS,NOMB,NOMEMMGR,NOMETAFILE,NOMINMAX,NOMSG,NOOPENFILE,NOSCROLL,NOSERVICE,NOSOUND,NOTEXTMETRIC,NOWH

,NOWINOFFSETS,NOCOMM,NOKANJI,NOHELP,NOPROFILER,NODEFERWINDOWPOS,NOMCX,_DEBUG

M. In the Additional include directories field, you should include <opnet_dir>\sys\include and any other directories that hold your header files.


3. Configure the project's Link settings.
A. Click on the Link tab in the Project->Settings window.
B. Change the Category pull-down menu to General.
C. Change the Object/library modules to the following:

opedets.lib opema.lib opet.lib opmmi.lib opsup.lib opprg.lib opvos.lib

For OPNET 8.1 and earlier, you will also need opvgx.lib  in the above libraries.

D. If you are building the DEBUG version, add msvcrtd.lib to the end of the Object/library modules entry.  For the RELEASE version, use msvcrt.lib.

E. Make sure the Link incrementally checkbox is NOT selected.
F. Change the Category pull-down menu to Input.
G. Add the following to the list of Ignore libraries.

libc.lib libcmt.lib libcd.lib libcmtd.lib

H. In the Additional library path field, add <opnet_dir>\sys\pc_intel_win32\lib and the any other directories that store necessary libraries.

I. Change the Category pull-down menu to Debug.
J. Make sure Microsoft format is chosen for the Debug info.
K. Click OK to save your changes.

4.Add your files to the project.
A. Select View->Workspace.
B. Click on the File View tab on the bottom of the left-hand panel.
C. Right-click on the Source Files folder and select Add Files to Folder...
D. Select your EMA source code.  You can multi-select files by holding the control key down while clicking on files.
E. Click OK to add the file(s).

5. Modify the PATH variable in your system environment to include <opnet_dir>\sys\pc_intel_win32\bin.

You may access the system environment variables by selecting Start->Settings->Control Panel and choosing the System entry. In the subsequent dialog box, select the Environment tab to view the system enviroment variables.

You now have a Visual C++ project that can be used to build and debug EMA programs.

Environment

Modeler, OPNET Modeling and Simulation, OPNET Modeler

Attachments
NOTICE: Riverbed® product names have changed. Please refer to the Product List for a complete list of product names.
Can't find an answer? Create a case