You can use ros::package::getPath("<my-package-name>") to get the path to <my-package-name>. You'll have to include ros/package.h.