Step-By-Step: Compiling and running a C console application in C++.NET
Open Visual Studio.NET
Start a new Visual C++, Win32 Console Application
- Click on File -> New -> Project
- The new Project dialog box appears
- In the LEFT window: Open the Visual C++ Projects folder
- In the LEFT window: Open the Win32 folder
- In the RIGHT window: click once on “Win32 Console Project”
- Below enter a name for the project, suggest you enter the name of our sample (for example ulai01)
- Click OK
- The Win32 Application Wizard dialog box appears
- Click on Application Settings
- Place a check mark for “Empty project”
- Click Finish
Add the Source file
- Referring to the Windows Solution Explorer at the right of your VS.NET window,
- Right mouse click on the Source Files folder
- Select ADD >
- Select Existing Item…
- The Add existing item dialog box appears
- Navigate your way to our source directory c:\Program Files\Measurement Computing\DAQ\c\sample32 and select the .c file you want to compile (for this example ulai01.c) and click OK
Add the library file
- Referring to the Windows Solution Explorer at the right of your VS.NET window,
- Right mouse click on the Resource Files folder
- Select ADD >
- Select Add Existing Item…
- The Existing Item dialog box appears
- Navigate your way to our source directory c:\Program Files\Measurement Computing\DAQ\c (go up one level)
- From the list of files, select cbw32.lib, and click OK
Add the header file (.h)
- Referring to the Windows Solution Explorer at the right of your VS.NET window,
- Right mouse click on the Header Files folder
- Select ADD >
- Select Existing Item…
- The Add Existing Item dialog box appears
- Navigate your way to our source directory c:\Program Files\Measurement Computing\DAQ\c
- From the list of files, select cbw.h, and click OK
Build the project
- From the Visual Studio menu, select Build > Build Solution
Run the program by pressing F5