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

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

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

Bardo gravatar image

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

ngrennan gravatar image

I'm trying to use ros in cpp with Visual Studio 2012. I wrote the publisher and subscriber tutorial (http:// wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29) and first, I configure the project as says in the guide (http:// wiki.ros.org/win_ros/hydro/Msvc%20SDK%20Projects).

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:// www.dropbox.com/s/o12m0l38gaxiugi/err... - https:// www.dropbox.com/s/ocdmf0wj6rj0962/err...

Can anyone helps me?

Thanks in advance

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

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

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

Comments

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 -0500 )edit
0

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

darshandoria gravatar image

Hello,

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

Stats

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

Seen: 620 times

Last updated: Oct 23 '15