I'm assuming that you created the package by doing something like "cd ~catkin_ws/src; catkin_create_pkg ".
Can you roscd to other packages in your catkin_ws? If not, you probably haven't sourced the appropriate setup.bash file (you probably want "source ~catkin_ws/devel/setup.bash").
EDIT: (I'm assuming that you're using bash as your shell, running on Ubuntu)
Each catkin workspace includes a setup.bash file that in turn runs a setup.sh file that sets environment variables needed for the various ros tools to work correctly. (e.g. specifying where in your system to look for ros packages).
Typing "source ~catkin_ws/devel/setup.bash" (where ~catkin_ws is the path to your catkin workspace) in your terminal will cause the commands in this file to be run.
If you want to avoid having to do that in every terminal that you open, add that command as a line in your ~/.bashrc file, which will cause it to be run every time you open a new terminal.
Originally posted by lindzey with karma: 1780 on 2013-06-25
This answer was ACCEPTED on the original site
Post score: 4
Original comments
Comment by expelliarmus on 2013-06-26:
Hey lindzey,
thanks for the answer. Can you tell me a bit more in detail about how to do that(source the setup.bash file)
Thanks in advance.
Edit: It worked! Thanks.
Comment by SeaTail on 2014-11-15:
Just to clarify because this answer was helpful but tripped me up, I first tried adding source ~catkin_ws/devel/setup.bash
to my ~/.bashrc file and that gave an error. Instead I had to add source catkin_ws/devel/setup.bash
(removing the "~").