Setting up Visual C++ for Maglev programming

This article shows you step by step how to configure the Microsoft Visual C++ for developing Maglev applications in a Windows environment. 

In brief, the only thing you need to do is to tell the VC++ where the Maglev files are, as shown below (Here we use Visual C++ 2008 Express Edition as example.)

1. Modify the default project settings 

To start, launch Microsoft Visual C++ but DO NOT OPEN ANY PROJECT/SOLUTION

Go to "Tools > Options…". 

Select "Projects and Solutions > VC++ Directories".  On the right panel, select "Include files" in the "Show directories for" drop-down box (highlighted in pink).




 Click on the "Add New Directory" icon and then enter the location of the Maglev head files.

Repeat the above steps and add the location of "mlhi_api_win32.lib" to the list of "Library files".


2. Link to the Maglev library

So far, you are almost done.  There is only one more step: to link the Maglev library file into your project.  Now you can create a new project, for example, an empty console application as shown below.




Next, go to "Project > Properties".

First of all, select "All Configurations" from the "Configuration" drop-down box so that the changes you make will be applied to both the Debug and Release configurations.

Next, select "Configuration properties > Linker > Input" from the navigation panel on the left.

Finally, type "mlhi_api_win32.lib" in "Additional Dependencies" and click OK.




3. To verify that VC++ has been properly configured, you may try to compile the "sine_motion" demo.  Since you have already created a project/solution for building a console application, right-click "Source Files>Add>Existing Item…" and then add "sine_motion.c" into the current project. Press F7 and the project should be successfully complied.