NodeHandle initRemappings() error (win_ros)

asked 2016-05-09 14:27:09 -0500

Leonid gravatar image

updated 2016-05-09 16:35:56 -0500

I'm trying to run my first MSVC-compiled ROS project by following the instructions from here:

The project involves building the 'hello world' talker from source - pretty straightforward.

I'm using Visual Studio Express 2012. I've been very careful to follow all the suggestions as far as project settings go. Yes, ROS_MASTER_URI is defined. The project compiles and links just fine, both in Debug and Release configurations. However, when I run the Release version from Visual Studio, I get an "access violation reading location 0x0" error with the following stack trace:

roscpp.dll!ros::NodeHandle::initRemappings(const std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > > & remappings) Line 195 C++

roscpp.dll!ros::NodeHandle::NodeHandle(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & ns, const std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > > & remappings) Line 85 C++

RosSample.exe!main(int argc, char * * argv) Line 64 C++

msvcr110.dll!_initterm(void (void) * * pfbegin, void (void) * * pfend) Line 889 C

This is my source code, minus all the lengthy comments (Line 64 in the above stack trace refers to the ros::NodeHandle n; statement):

#include "stdafx.h"
#include "ros/ros.h"
#include "std_msgs/String.h"

int main(int argc, char **argv)
  ros::init(argc, argv, "talker");

  ros::NodeHandle n;

  ros::Publisher chatter_pub = n.advertise<std_msgs::String>("chatter", 1000);

  ros::Rate loop_rate(10);

  int count = 0;
  while (ros::ok())

    std_msgs::String msg;

    std::stringstream ss;
    ss << "hello world " << count; = ss.str();





  return 0;

Looking at the NodeHandle source code ( ), the only things that I can begin to suspect are references to the remappings map in the NodeHandle constructor and initRemappings function, but that map should have been created using the M_String default constructor.

BTW, I tried running the Debug configuration build of my project and that one fails too, but even earlier, inside ros::init().

Any help greatly appreciated!

EDIT: win_ros explicitly mentions that it is "for native Windows development with the Microsoft Visual C++ Compilers 2010. Currently supporting either Windows SDK 7.1 (cl/nmake) or Visual Studio 10.0." I suspect this may be my problem, since I'm using VS 2012. Someone on here had a similar problem that was fixed by changing to the VS2010 platform toolset. I've yet to try that, but I ... (more)

edit retag flag offensive close merge delete


Any particular reason to delete the question?

gvdhoorn gravatar image gvdhoorn  ( 2016-05-09 14:41:39 -0500 )edit

I posted two copies of it by mistake. Looks like you closed the other one though...

Leonid gravatar image Leonid  ( 2016-05-09 14:57:29 -0500 )edit

Yes. I've restored this one.

gvdhoorn gravatar image gvdhoorn  ( 2016-05-09 15:14:03 -0500 )edit