Program is giving "segmentation fault (core dumped)" error on replit but not on visual studio

i did not get any errors when running my program in visual studio however on replit i am given the error “signal : segmentation fault (core dumped)” and i don’t understand why and have no idea what is even causing this to happen, any help would be much appreciated!


Repl link: https://replit.com/@TristanCarter1/Chess-Engine-Replit-C-20#main.cpp

Hi @TristanCarter1 thank you for your message.

I’ve just run your Repl and don’t get any errors at all. The game seems to work fine.

Can you please show a screenshot of the error and describe what you do before the error occurs?

@IanAtReplit are you sure? You selected the 1st option, but did not check the second.

1 Like

Thanks @AMDryzen5600X good spot. As there was no description of when the problem appeared I thought it was when they were attempting to play the engine.

Turned on the debugger to see if there were any useful messages / values I could use to find the cause after trying cout << "1"; etc to find the line of code that causes the issue. The errors appear to be caused by getline.

HOWEVER when I clicked run in the debugger and then run for the Repl and selected option 2 it worked and is currently playing the game engine vs engine without issue.

So it’s a weird one but I’d be interested in finding out if you can replicate the success when the debugger is running!

1 Like

I found the same success when running the debugger, very odd. Any idea as to how i can fix it so you don’t need the debugger open while running as i would like to publish the repl for people to use.

I have realised that there is a memory leak which does not bother visual studio but is why the program is crashing on replit.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.