K8055 in c++: console stops running after "Opendevice(0)"

Im working with a k8055 interface for school, but i can’t even get the simplest of the simplest to work: just make some leds light up.

my program looks like this

#include <cstdlib>
#include <iostream>
#include <windows.h>
#include "k8055.cpp"

int main()

{
init();
OpenDevice(0);
while (1)
  {
  WriteAllDigital(8);
  }
CloseDevice();
}

no important errors whatsoever (only “no newline at end of file”), the only thing that happens is the console appearing, and then quickly dissapearing, without any result on the output leds.
I first thought it was the compiler, but if write a simple hello world program combined with the program above, it won’t work until i remove “OpenDevice(0);”,“CloseDevice();” and every line between, or if i move those lines to the end of my program.

can anyone tell me either i’m doing something wrong?
please let me know

Maybe you have to use:
#include “K8055D_C.h”

Please see the C++ example in the package:
k8055_dll_2_001.zip
DLL rev 2 with examples and soure code (this source can be uses also with DLL Rev 3.)

You’ll find it on the Velleman downloads page:
velleman.eu/be/en/download/files/