Demonstrate what settings are needed for linking to the ros sdk.
You will need to have installed and tested the Msvc SDK. If it's your first time, install core libraries and the sdk to the default paths (C:\opt\rosdeps\hydro\x86 and C:\opt\ros\hydro\x86) so you do not need to change a host of configuration settings.
You'll also need either MS Visual C++ 2010 Express or MS Visual C++ 2010.
If you have the compiled SDK installed in the default location, a demo solution is installed into 'C:\work\ws\src\win_ros\tutorials'.
If you have the installed SDK, a tutorial on how to create a solution file from scratch can be found in the next section.
Creating Your Own Projects
Create A Project
Open Msvc and create a new Win32 Console Application project with the default settings. Now you can replace the content in the cpp file with the code from the talker example. Before you compile you need modify the project settings as described in the next section.
There are four project settings that you'll need to modify:
C/C++->General->Additional Include Directories
Linker->General->Additional Library Directories
As an example, on my system:
Additional Include Directories:
Processor definitions (prepend the following):
Additional Library Directories:
Library Dependencies (prepend the following):
User property sheets are an easier way of setting these (all except for the debugging environment variables) for a whole solution rather than doing it project by project. You can see an example of this in the reference tutorials solution (look for ros.props or open up the property manager in the solution).
You should try to build and run your project using the same configuration (release/debug) as your ROS SDK, at least when you run it for the first time. This might save you some pain.
Running Your Application Outside Of Msvc
If you want to run yout application direcly from the command you need set the following environment variables.
- ROS_IP (only used if the roscore is not on the same machine)
- ROS_HOSTNAME (only used if the roscore is not on the same machine)
You can either set these variables globally or set them with the following setup script.
set ROS_MASTER_URI=http://127.0.0.1:11311 set ROS_IP=127.0.0.1 set ROS_HOSTNAME=127.0.0.1 set PATH=C:\opt\rosdeps\hydro\x86\lib;C:\opt\rosdeps\hydro\x86\bin;C:\opt\ros\hydro\x86\lib;C:\opt\ros\hydro\x86\bin;%PATH%
If you want to develop under windows without Msvc but using directly catkin. Continue here