For brevity, these instructions assume the default installation location of C:\Program Files (x86)\Galil\gclib.
x_simple.c from VS2015 x64 Native Tools Command Prompt
Open VS2015 x64 Native Tools Command Prompt.
Copy files
Navigate to a convenient, empty, writable location.
Set an environment variable for the base path.
>set base=C:\Program Files (x86)\Galil\gclib
Copy simple example
>copy "%base%\examples\cpp\x_simple.c" .
Edit GOpen() call as necessary
In a text editor, open x_simple.c. Find the GOpen() call and update the address to match the desired hardware. See the documentation for GOpen() for address formatting options.
Compile
>cl x_simple.c "%base%\lib\dynamic\x64\*.lib" -I "%base%\include"
Set Path to DLL
>set PATH=%base%\dll\x64\;%PATH%
Execute
>x_simple.exe
version: 211.211.211 1.0.0.128
info: 192.168.0.42, DMCC640 Rev 1.0g, 9999
response: 3757802.0000
:
Using the pre-configured MSVC project (x_examples.cpp)
The directory gclib\examples\msvc has fully functional MSVC examples. These instructions detail how to use the 2015 version.
- Copy gclib\examples\msvc\2015_14.0\gclib_example to a convenient, writable location.
- Run gclib_example\gclib_example\copy_source.bat to copy the files.
- Open gclib_example\gclib_example.sln in Visual Studio 2015.
- In the Solution Explorer, expand the gclib_example and expand Source Files to show a listing of source.
- Open x_examples.cpp.
- Find the GOpen() call and update the address to match the desired hardware. See the documentation for GOpen() for address formatting options.
- Find the
#if 0
preprocessor block enclosing the example calls. Change to #if 1
to run the examples. Comment out the function calls to be avoided. Note some calls attempt to move motors and not all functions are compatible with all Galil products.
- Hit F5 to build and run the example.
Create Project with MSVC 2015 (x_examples.cpp)
The instructions below allow building a project from scratch.
The following instructions were performed on Visual Studio Professional 2015 and can be extended to other Visual Studio versions. For brevity, the instructions assume the default installation location of C:\Program Files (x86)\Galil\gclib and a build type of x64.
- Launch Visual Studio 2015.
- Choose File->New->Project.
- In the New Project dialog, choose Visual C++->Empty Project.
- Choose a Name, e.g. gclib_example.
- Choose a Location, e.g. C:\Users\user\Desktop.
- Check Create directory for solution.
- Click OK.
- In the Solution Explorer, right-click on Source Files and choose Add->Existing Item.
- Navigate to the gclib installation directory, then to examples\cpp in the installation directory.
- In File Name type x_*.cpp and click Add, this will filter out the files needed
- Select all files in the file chooser and click Add.
- In the Solution Explorer right-click on gclib_example, choose Properties.
- Click the Configuration Manager... button.
- Under Active solution platform: choose x64.
- Click Close.
- Highlight Configuration Properties in the side bar, and set the following project properties.
- At the top of the window, change Configuration: to All Configurations and ensure Platform lists Active(x64).
- Configuration Properties -> C/C++ -> Additional Include Directories add C:\Program Files (x86)\Galil\gclib\include
- Configuration Properties -> Linker -> General -> Additional Library Directories add C:\Program Files (x86)\Galil\gclib\lib\dynamic\x64
- Configuration Properties -> Linker -> Input -> Additional Dependencies add gclib.lib;gclibo.lib;
{rest of text}
where {rest of text}
is the original string that was in the cell. Note the semicolons between library files.
- Configuration Properties -> Debugging -> Environment add PATH=C:\Program Files (x86)\Galil\gclib\dll\x64;%PATH%
- Click OK.
- In the Solution Explorer open x_examples.cpp. Find the GOpen() call and update the address to match the desired hardware. See the documentation for GOpen() for address formatting options.
- Find the
#if 0
preprocessor blocks enclosing the example calls. Change to #if 1
to run the examples. Comment out the function calls to be avoided. Note some calls attempt to move motors and not all functions are compatible with all Galil products.
- Hit F5 to build and run the example.