Hidden Hidden Hidden Hidden
 
 

GETTING STARTED WITH MICROSOFT C/C++
PROGRAMMING > GETTING STARTED >

Compatibility

Version ≥ 3.6 of the instruNet C/C++ interface is compatible with Microsoft Visual Studio ≥ 2010 running on a 32bit or 64bit Windows ≥ 7 operating system. For compatibility details, click here.

Getting Started

To get started with Microsoft C/C++, please do the following steps:

  1. Make sure you have done Tutorial in its entirety.
  2. Install Microsoft C/C++ onto your hard disk, load an example program, compile, and then run to verify that your C/C++ is set up properly.
  3. Your program can be compiled 32bit or 64bit (i.e. target CPU set to"x86" or "x64") with instruNet software ≥ v3.6. To compile both Debug and Release, and both 32bit and 64bit versions of the examples, select Batch Build in the Build menu. For details, click here.
  4. Duplicate the "Program Files (x86) \ instruNet \ Programming Interfaces \ Visual C & C++" directory and place the copy somewhere in your Documents folder. We will work with the copy, which contains the following source files: Inet_int.c/.cpp, Inet_int.h, Inet_Ex1.c, Inet_Ex2.c, Inet_Ex3.c/.cpp, and iNet_mcs.h.
  5. Open "iNet32_ExampleN.sln" with the Microsoft Developer Studio, select Set Default Configuration under Build, choose Win32 Debug, press OK, select Debug > Step Into under Build and watch it compile.  You should not get any compiler errors or warnings.  If it builds properly, it will begin to run under the debugger.  Press the Step Over under Debug (i.e. F10) button to step through the example program. Note that "iNet32_Example1/2/3.sln" projects are C; and "iNet32_Example3_Cpp.sln" is C++.
  6. Step through the example program to verify that the compiler, example files, driver, and computer are all working well together.  Some lines of code open the instruNet World window, and pass control to instruNet World (until the user closes the instruNet World window to return back to the example program).  Don't let this freak you out.
  7. Read the example program source code and comments to get a feel for instruNet programming.
  8. Modify the Example source code to meet your own needs.
 
 

Adding instruNet to an Existing C Project (not C++)

If you want to add instruNet to an existing C project:

  • In the file directory that contains your source code, add another directory called "instrunet". And within that new directory add two additional new directories: instrunet_interface_DO_NOT_CHANGE and instrunet_myIO.
  • Dupilicate files Inet_int.c, Inet_int.h, and iNet_mcs.h and place the copies into the instrunet_interface_DO_NOT_CHANGE directory. Please try not to type into these files, since you might want to update them with new interface files from instrunet.com at a later date.
  • Select an example file that is most similar to what you are doing (e.g. iNetEx2.c or iNetEx3.c), copy it, rename it to inet_myIO.c, and then place it into the instrunet_myIO directory.
  • Add inet_myIO.c and inet_int.c to your project
    (i.e. select Project, Add Existing).
  • Create a new empty file, name it inet_myIO.h, and place it into the instrunet_myIO directory.
  • Add include "inet_myIO.h" to the top of the inet_myIO.c file. Also place this at the top of your C or C++ files that contain code that will call subroutines within inet_myIo.c.
  • Rename the WinMain() function at the top of inet_myIo.c to something different (e.g. void my_instrunet_io(void)).
  • Place a prototype for this new routine inside inet_myIo.h (e.g. void my_instrunet_io(void);)
  • Now add a call to my_instrunet_io(); from within your C or C++ code.
  • Compile, link, run and test.
  • Modify the code within inet_myIo.h/c as needed. Obviously, one can add more functions and structs to inet_myIo.c, and call these from your own C/C++ code.
 
 

Adding instruNet to an Existing C++ Project (not C)

Adding instruNet to an existing C++ project is similar to adding to an existing C project, described above, except one adds the following files to the project (instead of .c code): inet_int.cpp and inet_ex3.cpp. File inet_int.cpp is identical to inet_int.c, except for the name of the file. The same is true with inet_ex3.cpp and inet_ex3.c. One can then call "Run_InstruNet_Code();" from any of the C++ files, as done in file inet_example3_Cpp.cpp within project "iNet32_Example3_Cpp.sln". From here, you can place your instruNet functions into file inet_ex3.cpp and then call them from the rest of your C++ application.

 

Next Steps