
This feels like it should be a very simple solution, but I'm very much a Boost newbie, and relearning C++. I'm trying to set up a serial port in a class constructor of a legacy program I am updating. The serial port and io_service definitions are in the header file. The class is MFC. Header file declarations: boost::asio::serial_port port; boost::asio::io_service io; Here is the class constructor: CCplusplus_TesterDlg::CCplusplus_TesterDlg(CWnd* pParent) : CDialog(CCplusplus_TesterDlg::IDD, pParent), port(io, "COM3") { m_hIcon=AfxGetApp()->LoadIcon(IDR_MAINFRAME); } If I comment out the port and io declaration and the port initialization from the constructor, I can pass the constructor fine in debug mode. However, if I leave them in, I get the following: First-chance exception at 0x771a6b90 in Cplusplus_Tester.exe: 0xC0000005: Access violation writing location 0xccccccd0. Unhandled exception at 0x771a6b90 in Cplusplus_Tester.exe: 0xC0000005: Access violation writing location 0xccccccd0. Debug mode breaks in win_mutex.hpp at line 56: ::EnterCriticalSection (&crit_section); Go ahead. Make me feel like an idiot. Any clues as to what I am doing wrong? Thanks! -- View this message in context: http://boost.2283326.n4.nabble.com/Access-violation-when-setting-up-a-serial... Sent from the Boost - Users mailing list archive at Nabble.com.