简体   繁体   中英

No Way to get the console handle (Dev-Pascal)

I've tried the simple program for my exercise but if i compiled, it turned give a message "No Way to get the console handle" (Dev-Pascal).

Here's my code:

program square;
uses crt;

var
side,circumference,broad:real;

begin
    write('Input the side value of the square: ');
    readln(side);

    circumference := 4 * side;
    broad := side * side;

    writeln('The circumference value of the square = ', circumference);
    writeln('The abroad value of the square = ', broad);
    writeln();

    write('Press any key...');
    readkey();
end.

thank you for helping and teaching me i would appreciate

Dev-pascal comes with a 10+ years old Free Pascal version. I really have no idea. Try to run the example on the cmdline to see if dev-pascal is the cause or something else. Temporarily disable security software might also be something to try.

I suppose, you've created a Window Skeleton project. It has it's description: A Windows skeleton application (no window) .

In this case you'll get this error though you code compiles (I've got this error too with your code).

Try to create Console Application project which has it's own description: A standard console-based (MS-DOS) application (Your code has compiled and the program worked as well).

PS Can't say what exactly happens -- couldn't find any documentation about errors in Dev-Pas (1.9.2). My assumption is that skeleton program doesn't imply console window for execution program while console application does.

just close the project and then re-open the pascal source file (.pas). And maybe put "readln;" just before "END.".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM