Author Topic: Where is the c++ file created by QB64?  (Read 4508 times)

0 Members and 1 Guest are viewing this topic.

Offline Fifi

  • Forum Regular
  • Posts: 181
    • View Profile
    • My small QB64 contribution
Where is the c++ file created by QB64?
« on: October 01, 2018, 02:22:47 pm »
Hello all,

Just a simple (may be a dumb) question:

With Linux (as well as OS/X and Windows) QB64 translates the .bas source file in c++ (I guess a .cpp file), then compiles that c++ file to create the executable.

However, where is located this c++ file (just to see the translation) ?

TIA.

Cheers.
Fifi
It's better to look like an idiot for a short time while asking something obvious to an expert than pretending to be smart all your life. (C) Me.

Offline FilipeEstima

  • Newbie
  • Posts: 63
    • View Profile
Re: Where is the c++ file created by QB64?
« Reply #1 on: October 01, 2018, 02:24:21 pm »
Try qb64\internal\temp\main.txt
« Last Edit: October 01, 2018, 02:25:37 pm by FilipeEstima »

FellippeHeitor

  • Guest
Re: Where is the c++ file created by QB64?
« Reply #2 on: October 01, 2018, 02:30:38 pm »
Main.txt also includes several other files.

You must notice that main.txt itself is included in internal/c/qbx.cpp, which is the main file compiled by gcc.

Offline Fifi

  • Forum Regular
  • Posts: 181
    • View Profile
    • My small QB64 contribution
Re: Where is the c++ file created by QB64?
« Reply #3 on: October 02, 2018, 03:29:34 pm »
Hi Fellippe,

Thanx for your post.

Main.txt also includes several other files.

You must notice that main.txt itself is included in internal/c/qbx.cpp, which is the main file compiled by gcc.

Would it be possible for QB64 to create a "internal/c/myprog.cpp" the Vs the basic "internal/c/qbx.ccp" file when compiling the "myprog.bas" file, then to compile that "myprog.ccp" file?

a) This would allow QB64 to create separated .cpp files when it's started simultaneously from mutiple sessions (e.g. by a script launching several instances of QB64 to compile different source files without waiting the result of one or other compilation process to continue with the other source files),

b) This would be more relevant with the multi process systems we all are using today.

What do you think?

TIA for your response.

Cheers.
Fifi
It's better to look like an idiot for a short time while asking something obvious to an expert than pretending to be smart all your life. (C) Me.

FellippeHeitor

  • Guest
Re: Where is the c++ file created by QB64?
« Reply #4 on: October 02, 2018, 03:41:14 pm »
Multiple sessions of QB64 already generate multiple qbx.cpp files. You'll find qbx.cpp, qbx2.cpp, qbx3.cpp, etc.

Offline Fifi

  • Forum Regular
  • Posts: 181
    • View Profile
    • My small QB64 contribution
Re: Where is the c++ file created by QB64?
« Reply #5 on: October 02, 2018, 03:51:09 pm »
Hi again Fellippe,

Multiple sessions of QB64 already generate multiple qbx.cpp files. You'll find qbx.cpp, qbx2.cpp, qbx3.cpp, etc.

So, why not changing the name of the generated .cpp file accordingly to the .bas source file (e.g. myprog.bas would generate myprog.cpp when test.bas would generate test.cpp) in order to avoid confusion?

For me, that should not be a big change to do and really makes sens.

What do you think?

TIA.
Fifi
It's better to look like an idiot for a short time while asking something obvious to an expert than pretending to be smart all your life. (C) Me.

FellippeHeitor

  • Guest
Re: Where is the c++ file created by QB64?
« Reply #6 on: October 02, 2018, 03:53:31 pm »
For me, that should not be a big change to do and really makes sens.

What do you think?

Hi. I don't think it's a necessary change.

All the C++ work done in the background should remain away from the end user's eyes. What should matter is that your .bas code became an executable, not the process in-between.

If an advanced user wants to dig into the generated C++ output, then he/she should be able to grasp the current structure with no issue.
« Last Edit: October 02, 2018, 04:28:01 pm by FellippeHeitor »

Offline Fifi

  • Forum Regular
  • Posts: 181
    • View Profile
    • My small QB64 contribution
Re: Where is the c++ file created by QB64?
« Reply #7 on: October 02, 2018, 04:51:36 pm »
Hi Fellippe again,

I didn't say it's a necessary change, but only that would make sens especially if a progam such as a web server launch multiple sessions of QB64 at the same time, some of the .bas source files being very small or very large. Then, how to check a problem with prog1.bas or prog2.bas or ... progn.bas when you don't know what .cpp file was created when they all are named qbx?.cpp!

Not a complain, just a thought.

Cheers.
Fifi
It's better to look like an idiot for a short time while asking something obvious to an expert than pretending to be smart all your life. (C) Me.

FellippeHeitor

  • Guest
Re: Where is the c++ file created by QB64?
« Reply #8 on: October 02, 2018, 04:58:53 pm »
The qbx.cpp file and its variants never change contents. User code is translated into main.txt located in internal/temp (or internal/temp2, internal/temp3, according to the instance open). A user will know in which folder to look at when a C++ compilation error occurs because that information will be disclosed in the compilation log which is generated. The IDE shows a link to this log file and command line compilation shows the log file location when an error occurs.