I have tried compiling and running this program on a Windows system and it worked fine. When I try to compile and run on a Linux system, it compiles fine, but the core file appears when I run it.
After analysis, I think the problem is in the emplace_back() function. In the Windows environment, the emplace_back() function refers to the _M_realloc_insert() function; but in the Linux environment, the same location is replaced by the _M_emplace_back_aux() function.
I'm new to programming and don't understand why such a difference would cause the software to fail, and I'm hoping for an answer. If I want to run this program in Linux environment, how can I modify the main function?
I have tried compiling and running this program on a Windows system and it worked fine. When I try to compile and run on a Linux system, it compiles fine, but the core file appears when I run it.
After analysis, I think the problem is in the emplace_back() function. In the Windows environment, the emplace_back() function refers to the _M_realloc_insert() function; but in the Linux environment, the same location is replaced by the _M_emplace_back_aux() function.
I'm new to programming and don't understand why such a difference would cause the software to fail, and I'm hoping for an answer. If I want to run this program in Linux environment, how can I modify the main function?