+ 1

C++ with wxWidgets under WIndows - Built binary doesn't fully launch, but sometimes it does

I've been building a project in C++ with wxWidgets for a couple months now and suddenly now, even though the binary .exe file builds, when I launch the exe sometimes (most times) it doesn't show the GUI on screen and terminates but I don't know why. Sometimes it DOES launch and the program works fine. I've tried launching the program: from inside a terminal (power shell or cmd) in VS code (this is how i have been checking the program while developing) by double clicking the exe file from inside a cmd window and i get the same sort of reaction no matter where its run from. i altered cmakelists.txt to turn off building a -mwindows so it will show a console window on launch but there's no segfault or crash message/error. I also have a --console argument that pushes program messages out to std::cout and nothing is shown there when it doesn't launch, except the message i wrote to indicate it's running in --console mode. when the program does launch, everything works fine and messages shown in --console mode as expected. how the hell do you diagnose this? Edit: the source code for this project is here: https://github.com/Cabji/flip-gui/commit/8233b9a7b2825423315dd8e32cf22b1ce7922969 that's the commit that has the launching problem. I'm guessing it is something to do with bad memory allocation, but there's no errors output about this so I don't know?

15th Sep 2024, 1:47 AM
Nathan Stanley
Nathan Stanley - avatar
3 Answers
0
@Sharpneli oh i thought i had a cmakelists.txt available on the github repo. i'll look into that. i think i figured out i was doing a bit of circular inclusion while trying to make a child class chare data from its parent class. and this was making the unstable exe launch. i sort of reverted my code back and adjusted some of it and it seems to have fixed it up and i got the parent member data sharing to the child class now. i never thought you could get a binary that will run sometimes and not other times.
16th Sep 2024, 11:37 AM
Nathan Stanley
Nathan Stanley - avatar
0
Have you tried building the same application under Linux? The reason why I'm asking this question is that Microsoft wants to limit the use of building C++ desktop applications on Windows. They want you to use C# instead of C++. I'm not saying that's the reason why your application in C++ fails in Windows, because there can be thousand other reasons, but I'm afraid that the future for building C++ desktop applications on Windows doesn't looks good.
15th Sep 2024, 8:20 AM
Jan
Jan - avatar
0
I am unable to get the actual commit but is the problem available in main branch so I can look into it. Also there's no cmakelists file to build the program, I use nano with linux so building seperately with bash is a pain
16th Sep 2024, 12:25 AM
Sharpneli
Sharpneli - avatar