Instructions for creating a Visual Studio project to run a SimTK Core example program. SimTK 2.0, December 2009 Below we will use $(SimTK_INSTALL_DIR) to mean the SimTK installation directory, which is typically C:\Program Files\SimTK but can be anything. The installation process should have set this to the actual installation directory, but if not you must create a SimTK_INSTALL_DIR environment variable set to the appropriate "SimTK" installation directory. You must already have the SimTK Core binaries installed from SimTK.org; go to https://simtk.org/home/simtkcore, Downloads tab. If you want to use OpenMM acceleration, you must have installed that separately; go to https://simtk.org/home/openmm for information and downloads. To use the Visual Studio solution file provided in this directory proceed to step 5) To create a new Visual Studio project for a SimTK example from scratch follow all steps: 1) Create new Visual Studio project based on an example source file: * In Visual Studio, select File->New->Project...->Visual C++->Win32->Win32 Console Application * Select a name for the new project, select a location, and select "Create new Solution" * Click "Next"; select "Console Application" and "Empty project" * Drag the desired example .cpp program into the "Source files" folder on the left. 2) Set up include directory * Far click the Project name on the left bar, select "Properties" * Set the "Configuration:" pulldown to "All Configurations" * Under Configuration Properties->C++->General select "Additional Include Directories" * Select the "..." button, then the new directory (folder) button * Browse to $(SimTK_INSTALL_DIR)/include, and add it to the "Additional Include Directories" section * Click "OK" 3) Set up library directories * Far click the Project name on the left bar, select "Properties" * Set the "Configuration:" pulldown to "All Configurations" * Under Configuration Properties->Linker->General select "Additional Library Directories" * Select the "..." button, then the new directory (folder) button * Add BOTH $(SimTK_INSTALL_DIR)/lib and $(SimTK_INSTALL_DIR)/bin to the "Additional Library Directories" section. * Click "OK" 4) Set up library names * Far click the Project name on the left bar, select "Properties" a) Debug versions NOTE: Debug libraries are very sensitive to compiler version; if you can't use the prebuilt ones follow the Release instructions below unless you have built your own Debug libraries from source. CAUTION: You can't use Release libraries with a main program compiled with Debug. * Set the "Configuration:" pulldown to "Debug" * Under Configuration Properties->Linker->Input select "Additional Dependencies" * Select the "..." button * Add the following library names: SimTKmolmodel_d.lib SimTKsimbody_d.lib SimTKmath_d.lib SimTKcpodes_d.lib SimTKcommon_d.lib SimTKlapack.lib SimTKsimbody_aux_d.lib Note that there is no "_d" lapack library; that's OK. * Click "Apply" a) Release versions * Set the "Configuration:" pulldown to "Release" * Under Configuration Properties->Linker->Input select "Additional Dependencies" * Select the "..." button * Add the following library names: SimTKmolmodel.lib SimTKsimbody.lib SimTKmath.lib SimTKcpodes.lib SimTKcommon.lib SimTKlapack.lib SimTKsimbody_aux.lib * Click "Apply" 5) Run the program * select "Release" configuration in the Visual Studio main toolbar if you want speed; Debug is typically 10X slower. * Type Ctrl-F5, or click Debug->"Start Without Debugging" * Your program should run * Type Ctrl-Break in the cmd.exe window to stop the program 6) To run another example program: * Delete the previous example .cpp file from the "Source Files" folder * Drag the new example .cpp file into the "Source Files" folder * Select "Release" configuration, Ctrl-F5, etc.