0
#include <graphics.h>
using namespace std;

int main() {

    initwindow(500,500);
    rectangle(40,70,410,290);
    getch();

return 0;
}

This is my code and when i compile it this happens: compilier window nothing happens. Can someone explain why this happens?

genpfault
  • 51,148
  • 11
  • 85
  • 139
sswegg
  • 1
  • 4
  • 1
    https://stackoverflow.com/questions/7860569/how-i-can-get-and-use-the-header-file-graphics-h-in-my-c-program – Joe Davis Nov 11 '20 at 13:26
  • I do not think OP's error is related to that though @NullPointer? It seems like the exception is caused by writing to unallocated memory? – darclander Nov 11 '20 at 13:26
  • Does this answer your question? [Codeblocks graphics.h not working](https://stackoverflow.com/questions/41073789/codeblocks-graphics-h-not-working) – Codemaker2015 Nov 11 '20 at 13:27
  • _"Compilier doesnt compile graphics.h right in codeblocks"_ It looks like the code was compiled and ran. – Thomas Sablik Nov 11 '20 at 13:27
  • @Codemaker no it compiles but it doesn't print out anything and it should – sswegg Nov 11 '20 at 13:29
  • @darclander Bold assumption. The use of a very old library that is not kept up-to-date would most definitely be suspicion for a root cause to any problem within OPs code. – Joe Davis Nov 11 '20 at 13:29
  • Compiler has nothing to do with this: it successfully compiled the code since you were able to execute the program. Your program crashed due to an access violation, probably accessing some uninitialized pointer. You can try to run it in the debugger and see where exactly it crashes. – Zdeslav Vojkovic Nov 11 '20 at 13:29
  • 5
    https://stackoverflow.com/questions/41740791/graphics-h-not-working-in-code-blocks-with-mingw-in-windows-7-64bit Here seems to be a similar question with the same error. – darclander Nov 11 '20 at 13:31
  • @sswegg -- The year is 2020 going into 2021, not 1990. Stop using technology from 30 years ago. – PaulMcKenzie Nov 11 '20 at 14:19

0 Answers0