alandefreitas / matplotplusplus

Matplot++: A C++ Graphics Library for Data Visualization 📊🗾
https://alandefreitas.github.io/matplotplusplus/
MIT License
4.1k stars 311 forks source link

Plot not showing up - exit with error code 3 #381

Closed psykovski-extended closed 7 months ago

psykovski-extended commented 7 months ago

Bug category

Describe the bug

The issue I am facing seems kinda strange: The program compiles and links without any problems or warnings showing up in the console. But when I run the .exe file, there are no plots showing up - it just terminates with return value 3. I installed the code with cloning it into my projects directory and added it in the cmake file with add_subdirectory. OS: Windows 10 Home Compiler: gcc (11.2.0), g++ (11.2.0) (installed with Mingw) gnuplot version (gnuplot 5.4 patchlevel 8)

I also tried debugging it, but the program exits before it can even hit the first breakpoint...

Any suggestions for this? Thanks in advance!

Platform

psykovski-extended commented 7 months ago

I now was able to debug and to get a little bit more information on about what is going wrong: In the file common.cpp on line 56, pipe holds the value empty, therefore throwing an runtime error.

I checked if I am able to run this command gnuplot -e "set terminal wxt" 2>&1 on the command line - and it runs, but doesn't give any output. What would be the supposed output be on the command line? Is version 5.4.8 of gnuplot not supported by this library?

Edit: I dug a little further into the error, and I found out, that in the file popen.cpp on line 59, the creation of the process fails. I let the system output the error code with GetLastError() and it outputted 2, which should mean ERROR_FILE_NOT_FOUND, according to the internet.

psykovski-extended commented 7 months ago

As usual - go away from it for a week, come back to it and BAM! it works... I have changed nothing since the last time, but it seems like that it just decided to work - so sorry for interrupting real and serious issues, this one is now closed!

iamjadhav commented 4 months ago

@psykovski-extended

I'm facing the same issue with VS 19. Did it actually just go away? Could it have been because of a change in the git repo as you added Matplot as a subdirectory with FetchContent?

image

psykovski-extended commented 4 months ago

Are you able to call gnuplot from the command line? And I was using GCC, you are using Visual C++, maybe that's a problem?

iamjadhav commented 4 months ago

Yes, that was the problem. Stupidly enough, I did not have gnuplot. Installing it solved the issue. Thanks!