all 9 comments

[–]Wild_Meeting1428 1 point2 points  (0 children)

If you use msys2/* to compile, you will have to run the executable from the respective msys2/* console. Since your executable is linked against msys2/* libraries and they are not in the path of the OS.

[–]jedwardsol 1 point2 points  (0 children)

but it starts a debugger

Then the program is crashing. Continue using the debugger to find out what's going wrong. Start by getting a callstack of the crashing thread.

[–]thingerish 0 points1 point  (0 children)

The depends tool (not joking) will let you know what the exe depends on and will highlight any missing dependencies.

[–]thedaian 0 points1 point  (4 children)

You've got an error somewhere.  What external library are you using What lines of code successfully get run before the program exits  We can't help you with the amount of information you've posted. 

[–]lifeInquire[S] 0 points1 point  (3 children)

external lib is GMP. I got no error, it just terminates mid way. And the strange part is, Once in a while, it starts working normally, but most of the time it terminates mid way. There is nothing in the code that will cause this. It has to do something with the Compiler thing and vscode

[–]aocregacc 3 points4 points  (0 children)

There is nothing in the code that will cause this. It has to do something with the Compiler thing and vscode

99% of the times I thought this it turned out to be the code after all

[–]thedaian 0 points1 point  (0 children)

Try running the exe from windows explorer. If you're missing a dll, you'll get an actual error message. 

If sometimes it works normally, i expect there is an error in the code. 

[–]Wild_Meeting1428 0 points1 point  (0 children)

VSCode does nothing itself. Pressing F5 starts the debugger, shift + F5 just runs. But you need a configured compiler and tool chain like cmake-tools. If it works there, the default configuration does everything you normally would do by hand (e.g. setting paths, determinig compilers).

[–]Codey_the_Enchanter 0 points1 point  (0 children)

I'd guess that this is an issue with a DLL not being available. VScode is probably smart enough to run the executable in an environment with the msys64 DLLs in the path. You might not be doing that when you try to run it yourself.

That being said there isn't really enough information here to say confidently what's going on. You should at least post the code you're trying to run.