Author Topic: Compile to C?  (Read 2754 times)

0 Members and 1 Guest are viewing this topic.

Offline bugmagnet

  • Newbie
  • Posts: 6
    • View Profile
Compile to C?
« on: August 19, 2019, 02:34:59 am »
So I put QB64 on the PATH. I did a CD \tmp. I typed qb64 -? and got the help text. So then i tried to compile a local file to C. What I got is below. It was weird: I had to be specific about the path even though the source file was in the directory I was invoking from. And to cap it off, I couldn't find any C code anywhere.

Does "-z" actually work?

Interestingly, if you want to run the IDE with a file from the command line, you also need to put in the full path.
Code: QB64: [Select]
  1. C:\TMP>dir hello.bas
  2.  Volume in drive C is OS
  3.  Volume Serial Number is 2652-D365
  4.  
  5.  Directory of C:\TMP
  6.  
  7. 08/05/2019  10:41 PM               539 hello.bas
  8.               1 File(s)            539 bytes
  9.               0 Dir(s)  122,409,455,616 bytes free
  10.  
  11. C:\TMP>qb64 -z hello.bas
  12. QB64 COMPILER V1.3
  13.  
  14. CANNOT LOCATE SOURCE FILE:hello.bas
  15.  
  16. C:\TMP>qb64 -z .\hello.bas
  17. QB64 COMPILER V1.3
  18.  
  19. CANNOT LOCATE SOURCE FILE:.\hello.bas
  20.  
  21. C:\TMP>qb64 -z c:\tmp\hello.bas
  22. QB64 COMPILER V1.3
  23.  

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Compile to C?
« Reply #1 on: August 19, 2019, 02:49:56 am »
QB64 translates BAS to C, and then mingw compiles the C to an executable.

Your c-code can be located in internal\temp, with the majority of your program in main.txt.

Warning: it’s machine generated c and not pretty at all....
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bugmagnet

  • Newbie
  • Posts: 6
    • View Profile
Re: Compile to C?
« Reply #2 on: August 19, 2019, 04:59:53 am »
Decidedly unpretty. But that's usually the case with machine generated code.