ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

ros::init(…) throws an error - Windows roscpp

asked 2014-02-24 20:37:42 -0600

Bardo gravatar image

updated 2016-10-24 08:35:58 -0600

ngrennan gravatar image

I'm trying to use ros in cpp with Visual Studio 2012. I wrote the publisher and subscriber tutorial (http:// and first, I configure the project as says in the guide (http://

Then i compiled an linked the publisher, but when I tried to run it, ros::init(argc,argv,"talker") throws an exception... The console says that I ROS_MASTER_URI is not defined but I've got it defined

There are 2 images here: https:// - https://

Can anyone helps me?

Thanks in advance

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2014-02-25 13:18:28 -0600

Injun Park gravatar image

in my case, I have used the system environment variable to export ROS_MASTER_URI you can use windows system variable to set the variable ROS_MASTER_URI

open the environment variable setting windows , windows start -> control pane -> system -> advanced setting

click New button, and put ROS_MASTER_URI as variable name, and put the http://localhost:11311/ as its value.

and open the new DOS terminal, launch roscore. roscore will be operated well.

good luck.

edit flag offensive delete link more


I did that but I still have the same problem. I really don't understand why...

lilouch gravatar image lilouch  ( 2015-04-20 04:23:29 -0600 )edit

answered 2015-10-23 02:12:02 -0600

darshandoria gravatar image


I was facing the same problem, so for the solution of this problem, i deleted the "ros"folder from C:\ drive and extract it again from the zip file, n it works fine.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-02-24 20:37:42 -0600

Seen: 616 times

Last updated: Oct 23 '15