• Print

Author Topic: $CONSOLE does not work in WINDOWS 8 [support added*]  (Read 653 times)

SMcNeill

  • Hero Member
  • *****
  • Posts: 2414
    • Email
Re: $CONSOLE does not work in WINDOWS 8
« Reply #15 on: October 29, 2012, 03:31:10 AM »
Quote from: mcalkins on October 28, 2012, 10:36:47 PM
I'm going to guess that if you edit the recompile.bat of a console program to replace:
-mwindows
with:
-lgdi32 -lcomdlg32
and run it, that the program would perform as expected.

Only problem is recompile.bat doesn't even have a mwindows in it to change.  Here's the recompile.bat I have:
Code: [Select]
@echo off
cd %0\..\
echo Recompiling...
cd ../c
bin\g++ -mconsole -s -Wfatal-errors -w -Wall qbx.cpp  libqb\os\win\libqb_0_960_0000.o -lws2_32 -lwinspool parts\core\os\win\src.a -lopengl32 -lglu32 -lwinmm -lgdi32 -Wl,--subsystem,windows -static-libgcc -static-libstdc++ -D FREEGLUT_STATIC -lksguid -lole32 -lwinmm -ldxguid -o "..\..\untitled.exe"
pause

Of course, that's in the temp1 directory.  There's several more recompile.bat files in the other temp directories.  I'll go dig in them and see if they have mwindows in them...
http://bit.ly/TextImage -- Library of QB64 code to manipulate text and images, as a BM library.
http://bit.ly/Color32 -- A set of color CONST for use in 32 bit mode, as a BI library.

http://bit.ly/DataToDrive - A set of routines to quickly and easily get data to and from the disk.  BI and BM files

SMcNeill

  • Hero Member
  • *****
  • Posts: 2414
    • Email
Re: $CONSOLE does not work in WINDOWS 8
« Reply #16 on: October 29, 2012, 03:49:34 AM »
Quote from: mcalkins on October 28, 2012, 10:36:47 PM
If it works then, a more permanent fix might be to change, in qb64.bas:

Code: [Select]
    IF Console THEN x = INSTR(a$, "-mwindows"): a$ = LEFT$(a$, x - 1) + "-mconsole " + RIGHT$(a$, LEN(a$) - x + 1)

    IF inline_DATA = 0 THEN
        'add data.o?
        IF DataOffset THEN
            x = INSTR(a$, "-L.\l")
            IF x THEN
                x = x + 4
                a$ = LEFT$(a$, x) + " " + tmpdir2$ + "data.o" + RIGHT$(a$, LEN(a$) - x)
            END IF
        END IF
    END IF

    'add custom libraries
    'mylib$="..\..\"+x$+".lib"
    IF LEN(mylib$) THEN
        x = INSTR(a$, "-mwindows")
        IF x THEN
            x = x + 8
            a$ = LEFT$(a$, x) + " " + mylib$ + RIGHT$(a$, LEN(a$) - x)
        END IF
    END IF

to:

Code: [Select]
    IF inline_DATA = 0 THEN
        'add data.o?
        IF DataOffset THEN
            x = INSTR(a$, "-L.\l")
            IF x THEN
                x = x + 4
                a$ = LEFT$(a$, x) + " " + tmpdir2$ + "data.o" + RIGHT$(a$, LEN(a$) - x)
            END IF
        END IF
    END IF

    'add custom libraries
    'mylib$="..\..\"+x$+".lib"
    IF LEN(mylib$) THEN
        x = INSTR(a$, "-mwindows")
        IF x THEN
            x = x + 8
            a$ = LEFT$(a$, x) + " " + mylib$ + RIGHT$(a$, LEN(a$) - x)
        END IF
    END IF

IF Console THEN x = INSTR(a$, "-mwindows"): a$ = LEFT$(a$, x - 1) + "-mconsole -lgdi32 -lcomdlg32 " + MID$(a$, x + 10)


My QB64.bas source looks a bit different than what you posted as well.  Compare this to what you showed for your original:

Code: [Select]
    IF Console THEN
        IF C_Core = 0 THEN
            x = INSTR(a$, "-mwindows"): a$ = LEFT$(a$, x - 1) + "-mconsole " + RIGHT$(a$, LEN(a$) - x + 1)
        END IF
        IF C_Core = 1 THEN
            x = INSTR(a$, " -s"): a$ = LEFT$(a$, x - 1) + " -mconsole" + RIGHT$(a$, LEN(a$) - x + 1)
        END IF
    END IF

    IF inline_DATA = 0 THEN
        'add data.o?
        IF DataOffset THEN
            x = INSTR(a$, ".cpp ")
            IF x THEN
                x = x + 3
                a$ = LEFT$(a$, x) + " " + tmpdir2$ + "data.o" + " " + RIGHT$(a$, LEN(a$) - x)
            END IF
        END IF
    END IF

My source has a C_Core decision to make, and then the IF x THEN x = x +3, whereas yours reads x = x + 4.

Are you using GL or SDL version?  This is what the SDL version shows for me.  I'm not certain if the GL is any different.

EDIT:  Both GL and SDL source looks the same in this area.
http://bit.ly/TextImage -- Library of QB64 code to manipulate text and images, as a BM library.
http://bit.ly/Color32 -- A set of color CONST for use in 32 bit mode, as a BI library.

http://bit.ly/DataToDrive - A set of routines to quickly and easily get data to and from the disk.  BI and BM files

SMcNeill

  • Hero Member
  • *****
  • Posts: 2414
    • Email
Re: $CONSOLE does not work in WINDOWS 8
« Reply #17 on: October 29, 2012, 04:22:33 AM »
UPDATE:   (And I'm lost....)

When I noticed my source didn't match your source, I re-downloaded QB64 SDL version.   A fresh extract, open the source, and it looks just like what you posted.

I take a moment, scratch my head, and then try a simple program  with nothing but $CONSOLE in it. 

Guess what?

It works!

???

I just installed QB64 back on the computer a few days ago when I put WIN 8 fresh on the machine...   Got it from the same place...   Only thing I can think is maybe I downloaded the GL and overwrote part of the SDL version?   All the dlls and such was in the folder, so I know the SDL version had to have put them in there - they don't even come with the GL package.

To be honest, in this case, I'm just lost.  As it is, it's working now, when it wasn't before...   Looks like you might have spent all that time and effort digging around for the answer to a problem that neither of us would have foresaw the solution to.  I suppose it's true - when all else fails, go back to start and rebuild from the ground up.   It seems in this case something was off with the foundation of my QB64 itself; a fresh install of a new download fixed the issue.

I just wish I knew what happened to corrupt the other version.  I've got GL and SDL versions on my computer, but they're in different folders (C:\QB64 and C:\QB64GL), and I'm certain I only extracted them once each.  I swear, it's the Microsoft Gremlin(tm) at work just making life difficult for me...

As it is, it's working now.  I'm sorry for all the time and effort you put into finding a solution to a problem in the source, that apparently didn't really exist, and I thank ye for the hard work.  It still seems as if $CONSOLE doesn't work in the GL version (or maybe that's corrupted for me as well and I should try a fresh download of it?), so perhaps your solution will help Galleon get it up and going for the next GL update. 

Stupid computers.   I swear they're out to get me!  LOL!   
http://bit.ly/TextImage -- Library of QB64 code to manipulate text and images, as a BM library.
http://bit.ly/Color32 -- A set of color CONST for use in 32 bit mode, as a BI library.

http://bit.ly/DataToDrive - A set of routines to quickly and easily get data to and from the disk.  BI and BM files

mcalkins

  • Hero Member
  • *****
  • Posts: 1269
    • qbasicmichael.com
    • Email
Re: $CONSOLE does not work in WINDOWS 8
« Reply #18 on: October 29, 2012, 09:49:51 AM »
I was using 0.954 SDL.



I tried $CONSOLE with the GL 3 version 0.960, and it fails on Windows XP also.

In the recompile.bat for a $CONSOLE program, remove:
-Wl,--subsystem,windows

To fix qb64.bas, change:
Code: [Select]
        IF C_Core = 1 THEN
            x = INSTR(a$, " -s"): a$ = LEFT$(a$, x - 1) + " -mconsole" + RIGHT$(a$, LEN(a$) - x + 1)
        END IF

to:

Code: [Select]
IF C_Core = 1 THEN
 x = INSTR(a$, " -s"): a$ = LEFT$(a$, x - 1) + " -mconsole" + RIGHT$(a$, LEN(a$) - x + 1)
 x = INSTR(a$, " -Wl,--subsystem,windows"): a$ = LEFT$(a$, x - 1) + MID$(a$, x + 24)
END IF



Quote
As it is, it's working now.  I'm sorry for all the time and effort you put into finding a solution to a problem in the source, that apparently didn't really exist, and I thank ye for the hard work.  It still seems as if $CONSOLE doesn't work in the GL version (or maybe that's corrupted for me as well and I should try a fresh download of it?), so perhaps your solution will help Galleon get it up and going for the next GL update.

No problem. It was fun. :-)

Regards,
Michael
The QBASIC Forum Community: http://www.network54.com/index/10167 Includes off-topic subforums.
QB64 Off-topic subforum: http://qb64offtopic.freeforums.org/

Clippy

  • Hero Member
  • *****
  • Posts: 16445
  • I LOVE π = 4 * ATN(1)    Use the QB64 WIKI >>>
    • Pete's Qbasic Site
    • Email
Re: $CONSOLE does not work in WINDOWS 8
« Reply #19 on: October 29, 2012, 09:54:44 AM »
I wonder how that happened? Did you accidentally install them both in the same QB64 folder Sam?
QB64 WIKI: Main Page
Download Q-Basics Code Demo: Q-Basics.zip
Download QB64 BAT, IconAdder and VBS shortcuts: QB64BAT.zip
Download QB64 DLL files in a ZIP: Program64.zip

SMcNeill

  • Hero Member
  • *****
  • Posts: 2414
    • Email
Re: $CONSOLE does not work in WINDOWS 8
« Reply #20 on: October 29, 2012, 10:07:42 AM »
Quote from: Clippy on October 29, 2012, 09:54:44 AM
I wonder how that happened? Did you accidentally install them both in the same QB64 folder Sam?

No clue.  One is in a QB64SDL folder, the other is in QB64GL.  The SDL folder had the dlls and such in it, so I didn't extract the GL version into 2 different folders.  It's honestly a mystery to me how the GL files got into the SDL folder.

However it happened though, a fresh download fixed the problem.  I wonder if Michael's fix will let the GL version open a console now?
http://bit.ly/TextImage -- Library of QB64 code to manipulate text and images, as a BM library.
http://bit.ly/Color32 -- A set of color CONST for use in 32 bit mode, as a BI library.

http://bit.ly/DataToDrive - A set of routines to quickly and easily get data to and from the disk.  BI and BM files

Clippy

  • Hero Member
  • *****
  • Posts: 16445
  • I LOVE π = 4 * ATN(1)    Use the QB64 WIKI >>>
    • Pete's Qbasic Site
    • Email
Re: $CONSOLE does not work in WINDOWS 8
« Reply #21 on: October 29, 2012, 11:16:14 AM »
It should. The GL version has a lot of stuff not working yet.
QB64 WIKI: Main Page
Download Q-Basics Code Demo: Q-Basics.zip
Download QB64 BAT, IconAdder and VBS shortcuts: QB64BAT.zip
Download QB64 DLL files in a ZIP: Program64.zip

unseenmachine

  • Hero Member
  • *****
  • Posts: 3285
  • A fish, a fish, a fishy o!
Re: $CONSOLE does not work in WINDOWS 8
« Reply #22 on: October 29, 2012, 02:50:47 PM »
Here's my one i did ages ago incase it can shed any light on the subject...http://www.qb64.net/forum/index.php?topic=3795.0
UnseenGDK Download : http://dl.dropbox.com/u/8822351/UnseenGDK.bm
GDK Tutorial : http://dl.dropbox.com/u/8822351/UnseenGDK_Tutorial.doc
VQB02 : http://dl.dropbox.com/u/8822351/VQB02.zip

mcalkins

  • Hero Member
  • *****
  • Posts: 1269
    • qbasicmichael.com
    • Email
Re: $CONSOLE does not work in WINDOWS 8
« Reply #23 on: March 23, 2013, 06:27:23 PM »
QB64 0.971b qb64.bas patch:

Code: [Select]
--- C:/qgl/qb64/qb64.txt Wed Jan 16 04:07:18 2013
+++ C:/qgl/qb64/qb64x.bas Sun Mar 24 01:09:28 2013
@@ -10927,9 +10927,10 @@
         IF C_Core = 0 THEN
             x = INSTR(a$, "-mwindows"): a$ = LEFT$(a$, x - 1) + "-mconsole " + RIGHT$(a$, LEN(a$) - x + 1)
         END IF
-        IF C_Core = 1 THEN
-            x = INSTR(a$, " -s"): a$ = LEFT$(a$, x - 1) + " -mconsole" + RIGHT$(a$, LEN(a$) - x + 1)
-        END IF
+IF C_Core = 1 THEN
+ x = INSTR(a$, " -s"): a$ = LEFT$(a$, x - 1) + " -mconsole" + RIGHT$(a$, LEN(a$) - x + 1)
+ x = INSTR(a$, " -Wl,--subsystem,windows"): a$ = LEFT$(a$, x - 1) + MID$(a$, x + 24)
+END IF
     END IF
 
     IF inline_DATA = 0 THEN

Regards,
Michael
The QBASIC Forum Community: http://www.network54.com/index/10167 Includes off-topic subforums.
QB64 Off-topic subforum: http://qb64offtopic.freeforums.org/

Galleon

  • Administrator
  • Hero Member
  • *****
  • Posts: 4664
  • QB Forever
    • Email
Re: $CONSOLE does not work in WINDOWS 8
« Reply #24 on: April 03, 2013, 09:30:38 PM »
Thanks for the mwindows vs --subsystem,windows tip. I ended up just changing makeline.txt, but I still made some changes to the way $CONSOLE is handled in Windows which were no longer relevant (they were required to work-around SDL's redirection of cin & cout).
Something old... Something new... Something borrowed... Something blue...

  • Print