0

Windows 10

MSCV 19.25.28614.0

Boost 1.72.0

While attempting to initalise a basic message queue taken from sample code in the docs:

 message_queue mq
        (create_only               //only create   
            , "message_queue"           //name   
            , 100                       //max message number   
            , sizeof(int)               //max message size   
        );

I get a run time error about a unhandled exception boost::interprocess::interprocess_exception in the function bool shared_memory_object::priv_open_or_create in shared_memory_object.hpp. Has anyone experienced this error on Windows and if so do you have any advice on how to fix it?

Tom
  • 1,235
  • 9
  • 22

1 Answers1

1

I'm an idiot. Make sure you add:

message_queue::remove("message_queue");

Before you attempt to create one:

 message_queue mq
        (create_only               //only create   
            , "message_queue"           //name   
            , 100                       //max message number   
            , sizeof(int)               //max message size   
        );
Tom
  • 1,235
  • 9
  • 22