First, note that you SHOULD not remove the queue while you have it open. Assuming, for the sake of this answer that you donot actually do that in your real code, and the exception is raised in the message_queue constructor.
You should start by handling the exception and finding out the cause:
try {
boost::interprocess::message_queue mq(boost::interprocess::open_or_create, "my_queue", 100, 10);
} catch (boost::interprocess::interprocess_exception const& ex) {
std::cout << ex.what() << std::endl;
}
However, in your case, it looks like the message is going to be "boost::interprocess_exception::library_error". Sadly, that means that there is no useful message (see exceptions.hpp):
else if(str){
m_str = str;
}
else{
m_str = "boost::interprocess_exception::library_error";
}
In that case, I'd suggest hooking up your trusty debugger and seeing at what point the exception is raised. E.g. in gdb you could do:
(gdb) start
(gdb) catch throw
(gdb) run
And you will can get the backtrace at the time the exception is raised.
If that doesn't help, consider checking the OS support required, and to rule out permission issues.