Author Topic: Waiting at the end of the compilation  (Read 4437 times)

0 Members and 1 Guest are viewing this topic.

Offline krovit

  • Forum Regular
  • Posts: 179
    • View Profile
Waiting at the end of the compilation
« on: January 16, 2022, 12:51:27 pm »
Hello!

How do you tell the compiler not to stop when the compilation is finished waiting for you to press a key?
Nothing is easy, especially when it appears simple (and nothing could be as dangerous as trying to do good to others)

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Waiting at the end of the compilation
« Reply #1 on: January 16, 2022, 12:58:56 pm »
I don't think I've ever seen it wait for a keypress before a Run, anyway...

Are you just compiling and no Run?

You can send a keypress with QB64 in code program, don't remember keyword at moment.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Waiting at the end of the compilation
« Reply #2 on: January 16, 2022, 03:59:55 pm »
If you are running the compiler using a batch file, add a Pause statement at the end batch file.

Offline krovit

  • Forum Regular
  • Posts: 179
    • View Profile
Re: Waiting at the end of the compilation
« Reply #3 on: January 16, 2022, 05:05:46 pm »
Wait press any key with command line in a file batch:

d:\qb64\qb64.exe -c %cd%\NC_06.bas -o %cd%\NC_06.exe

NC_06.bas is a complex program with many lines.

I use DavsIDE as an editor environment and also with it waits for the press of a key.

As an editor environment I use DavsIDE and also with it waits for the press of a key simpler (or very simple) programs, on the other hand, are executed immediately after compilation.
If I load the programs into the QB64 editor after compilation, usually but not always, the execution starts... I don't understand the logic !!




Nothing is easy, especially when it appears simple (and nothing could be as dangerous as trying to do good to others)

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Waiting at the end of the compilation
« Reply #4 on: January 17, 2022, 11:07:01 am »
Oh, so you're using this program to compile. I thought you were trying your own IDE and calling the compilation via a BAT file. So, I don't know the program, the author will answer it best. The only thing that bothers me is the annoying thing - do you happen to use national (ie non-US) characters in the name of the file that is compiled into EXE? I assume that even the current IDE simply does not have accessible folders with a name that contains national Unicode characters. The solution has existed for a long time, but - I don't want to task anyone. I don't want to and I won't. He would just have to integrate Direntry.h into the IDE and then fix that. Maybe that's the reason. If the compilation takes place and the exe file can to run separately, there can be no other reason.

For example, in the current IDE, if you try to save a file to a folder that has unicode characters in its name, it will fail. It ends with the message Error -07b2101 Path not found.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Waiting at the end of the compilation
« Reply #5 on: January 17, 2022, 11:15:57 am »
There's one more thing. The question is how Dav's IDE checks for the existence of an EXE file. The correct solution is to expect some value from the compiler that the compilation has taken place. Another thing that may (at first glance) not run the finished EXE is the STOP statement in the compiled source, if the conditions for it are met. For example, this source does not start at first glance, even though it does:

IF COMMAND$ = "" THEN STOP

Offline krovit

  • Forum Regular
  • Posts: 179
    • View Profile
Re: Waiting at the end of the compilation
« Reply #6 on: January 17, 2022, 02:30:47 pm »
Thank You Petr,

I'll be honest: I understood almost nothing of your answer. My problem! I'm not that far ahead of computer science...

But it seems useful for everyone to further specify the following:

I don't use national unicode characters (just to maintain maximum compatibility everywhere).
I use the Dav editor and compile in the way of the editor: F5! Obviously after indicating the location of QB64. The only command added is "-c".
Some programs (usually small or very small ones) compiles them and runs them without waiting. Many others do not.
There are no reasons why one can understand the reason.

Discouraged by the results, at this point, I have to compile from command line with a batch file. The command string is taken from the QB64 wiki, so nothing fancy.
The result obtained is the same.

An important clue may be that until version 1.5 of QB64 this problem had never arisen. In fact, I tried to compile the same file NC_06.bas with QB64 v.1.5 and the execution started immediately!

I read here on the forum that changing the code is a very complex operation (I believe it!) so I can not expect that those who could do it, but it seems useful that we know about this small but boring inconvenience.

Maybe who knows... at the bottom of the source code there is a simple pause instruction to be deleted...









Nothing is easy, especially when it appears simple (and nothing could be as dangerous as trying to do good to others)

Offline RhoSigma

  • QB64 Developer
  • Forum Resident
  • Posts: 565
    • View Profile
Re: Waiting at the end of the compilation
« Reply #7 on: January 17, 2022, 03:42:47 pm »
Hi @krovit,

looking at the screenshot in your first post I see it's qb64.exe (the compiler itself) which will wait, this only happens if the compiling fails for some reason, although I can't see any error message in your screenshot.

So, have you ever tried to load your program into the QB64 IDE directly and compile/run it from there (F5), you should see failues there in the status area.

An important clue may be that until version 1.5 of QB64 this problem had never arisen. In fact, I tried to compile the same file NC_06.bas with QB64 v.1.5 and the execution started immediately!

Well, this could explain everything, until QB64 v1.5 it had a bug, which many people accept and even use in their programs, but which got fixed in later versions. This requires to change the affected programs to not longer use/relying on this bug. Read here: https://qb64forum.alephc.xyz/index.php?topic=4209.msg135786#msg135786
My Projects:   https://qb64forum.alephc.xyz/index.php?topic=809
GuiTools - A graphic UI framework (can do multiple UI forms/windows in one program)
Libraries - ImageProcess, StringBuffers (virt. files), MD5/SHA2-Hash, LZW etc.
Bonus - Blankers, QB64/Notepad++ setup pack

Offline krovit

  • Forum Regular
  • Posts: 179
    • View Profile
Re: Waiting at the end of the compilation
« Reply #8 on: January 18, 2022, 05:01:41 am »
Thank you, RhoSigma.

With the transition to version 2.x I had encountered problems with recursive calls to functions (1.x version).
It was difficult to remedy (also because with version 1.x everything worked wonderfully).
The solution was a different approach to things.

I compiled directly with QB64 and the pause does not occur.
The only warning that appears - not blocking - is the one I attach.
How should I interpret this report?
I also tried to change the names of variables and procedures but the warning remains.

Nothing is easy, especially when it appears simple (and nothing could be as dangerous as trying to do good to others)

Offline RhoSigma

  • QB64 Developer
  • Forum Resident
  • Posts: 565
    • View Profile
Re: Waiting at the end of the compilation
« Reply #9 on: January 18, 2022, 08:14:29 am »
Warnings don't hurt the compilitaion process, it's just for you, if you wanna clean up your code.

Empty SELECT CASE blocks are actually a SELECT CASE/END SELECT constructs without any CASE in between, hence you could delete or comment the whole block to get rid of the warning.

Unused variables are those you explicitly DIMed somewhere or those defined in a parameter list of a SUB/FUNCTION, but they are actually never used in any way anywhere in the program or the respective SUB/FUNC. You usually could delete or comment the respective DIMs and take out unused parameter variables from defined SUBs and FUNCTIONs. In alternative (sorry @FellippeHeitor) simply DON'T USE OPTION _EXPLICIT.
My Projects:   https://qb64forum.alephc.xyz/index.php?topic=809
GuiTools - A graphic UI framework (can do multiple UI forms/windows in one program)
Libraries - ImageProcess, StringBuffers (virt. files), MD5/SHA2-Hash, LZW etc.
Bonus - Blankers, QB64/Notepad++ setup pack