Author Topic: C++ compilation failed  (Read 4684 times)

0 Members and 1 Guest are viewing this topic.

Offline helium5793

  • Newbie
  • Posts: 7
    • View Profile
C++ compilation failed
« on: March 23, 2020, 10:11:21 am »
I am running under Fedora 31 linux.  I am trying to resurrect an old qb45 program. 
Code: QB64: [Select]
  1. TYPE presdent
  2.     firstname AS STRING * 12
  3.     midinit AS STRING * 1
  4.     lastname AS STRING * 15
  5.     picname AS STRING * 8
  6.     party AS STRING * 12
  7.     startyear AS INTEGER
  8.     endyear AS INTEGER
  9.     bornyear AS INTEGER
  10.     dieyear AS INTEGER
  11.     bpcity AS STRING * 14
  12.     bpstate AS STRING * 2
  13.     age AS INTEGER 'age at which they became president
  14.     flady AS STRING * 12
  15.     vicepres AS STRING * 24
  16.     earlyact AS STRING * 50
  17.     presact AS STRING * 50
  18.     ancestry AS STRING * 14
  19.     profess AS STRING * 18
  20.     religion AS STRING * 14
  21.     rank AS STRING * 20
  22.     nicknam AS STRING * 46
  23.     alma AS STRING * 16
  24.     firsts AS STRING * 50
  25.     astrosign AS STRING * 12
  26.     general AS STRING * 50
  27.     buried AS STRING * 20
  28.     DTA AS STRING * 42
  29. DIM pres AS presdent
  30. OPEN "presdent.dta" FOR RANDOM AS #1 LEN = LEN(pres)
  31. INPUT "starting record"; i%
  32. i% = i% - 1
  33.     i% = i% + 1
  34.     GET #1, i%, pres
  35.     IF i% > 41 THEN CLOSE: END
  36.     PRINT i%, pres.lastname
  37.     tryagain:
  38.     LINE INPUT "buried: ", ax$
  39.     IF LEN(ax$) > 20 THEN BEEP: GOTO tryagain
  40.     pres.buried = ax$
  41.     a = pres.age
  42.     IF a = 0 THEN CLOSE: END
  43.  
  44.     PUT #1, i%, pres
  45. LOOP UNTIL pres.vicepres = STRING$(24, CHR$(0))
  46.  
  47.  

above is the code, and here is the error message. recompile_lnx.sh

#!/bin/sh
Pause()
{
OLDCONFIG=`stty -g`
stty -icanon -echo min 1 time 0
dd count=1 2>/dev/null
stty $OLDCONFIG
}
echo "Recompiling..."
cd ../c
g++ -no-pie -w qbx.cpp  libqb/os/lnx/libqb_1_4_0001000000000.o  -D DEPENDENCY_NO_SOCKETS -D DEPENDENCY_NO_PRINTER -D DEPENDENCY_NO_ICON -D DEPENDENCY_NO_SCREENIMAGE -D DEPENDENCY_AUDIO_OUT  parts/audio/out/os/lnx/src.a parts/core/os/lnx/src.a -lGL -lGLU -lX11 -lpthread -ldl -lrt -D FREEGLUT_STATIC -o '../../LOADDATA'
echo "Press ENTER to exit..."
Pause

any ideas on how to correct this would be appreciated
Thanks,
John

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: C++ compilation failed
« Reply #1 on: March 23, 2020, 11:40:21 am »
well I do not believe its your code. as this compiles just fine on windows. Hopefully somebody that runs Linux will time in here soon.
Granted after becoming radioactive I only have a half-life!

Offline dbosely

  • Newbie
  • Posts: 3
    • View Profile
Re: C++ compilation failed
« Reply #2 on: March 23, 2020, 10:08:13 pm »
Hi
My first post. 
I copied your code into QB64 Version 1.4 in a Linux Mint 19.3 ThinkPad E550 laptop.
It compiled just fine.
Hope that is of some benefit to you.

After the successful compile, I got a black screen with this prompt:  starting record? and a blinking cursor.

I have had my own problems with Compile failure.  I converted a fairly complex program I wrote some years ago in QB 4.5 into QB64.  At first it compiled OK. As I continued to modify the app, it suddenly would not compile.  QB64's error message invited me to check a log file that was non-existent (completely empty) .

Here is the strange part:  I have several examples of QB64 on my three computers.  If I load my app into a different copy of QB64, (even on the same computer) the app will compile OK!  That is, until I save it.  I can even do some simple adjustments to the app and it will continue to compile until I perform a 'Save', then the same compile error and empty error log.  Once I get the compile error, no future efforts to compile that app is successful.  Other apps will compile just fine, though.
This problem is what brought me to this thread.

Anybody have a clue as to what is going on here?
What can I do to finish my app (which I really would like to use)?
Darrell Bosely

Offline helium5793

  • Newbie
  • Posts: 7
    • View Profile
Re: C++ compilation failed
« Reply #3 on: March 24, 2020, 12:34:02 am »
Thank you both.  I know the code ran under quick basic years ago.  It is good to know it is not the code.  I think I will try reinstalling qb64 and see what happens.  Maybe even in windows in a virtual box.  I am actually more interested in recovering the data in the data file that it is trying to load, but if it doesn't compile, it doesn't load the data.  Thanks for your help!
John

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: C++ compilation failed
« Reply #4 on: March 24, 2020, 11:22:50 am »
Ah, if you just want the data and it works in Windows, maybe someone could just run the data file for you?

FellippeHeitor

  • Guest
Re: C++ compilation failed
« Reply #5 on: March 24, 2020, 11:28:25 am »
Quote
above is the code, and here is the error message. recompile_lnx.sh

#!/bin/sh
Pause()
{
OLDCONFIG=`stty -g`
stty -icanon -echo min 1 time 0
dd count=1 2>/dev/null
stty $OLDCONFIG
}
echo "Recompiling..."
cd ../c
g++ -no-pie -w qbx.cpp  libqb/os/lnx/libqb_1_4_0001000000000.o  -D DEPENDENCY_NO_SOCKETS -D DEPENDENCY_NO_PRINTER -D DEPENDENCY_NO_ICON -D DEPENDENCY_NO_SCREENIMAGE -D DEPENDENCY_AUDIO_OUT  parts/audio/out/os/lnx/src.a parts/core/os/lnx/src.a -lGL -lGLU -lX11 -lpthread -ldl -lrt -D FREEGLUT_STATIC -o '../../LOADDATA'
echo "Press ENTER to exit..."
Pause

To be able to help with "C++ Compilation failed" errors, we need you to send us the contents of the internal/temp/compilelog.txt file, immediately after the error occurs. That'll point us in the right direction to assist you.

Offline helium5793

  • Newbie
  • Posts: 7
    • View Profile
Re: C++ compilation failed
« Reply #6 on: March 24, 2020, 11:09:55 pm »
I loaded qb64 onto a windows 7 virtual box and recovered my data with no problem.  I then went back to my linux system, deleted the qb64 directory,  redownloaded qb64 and reinstalled it and the error went away.   It now works with no C++ error. Anyway thanks for the help.  I got my data!!
John

Offline dbosely

  • Newbie
  • Posts: 3
    • View Profile
Re: C++ compilation failed
« Reply #7 on: March 25, 2020, 01:46:33 am »
I cannot give you the contents of the error log since it contains nothing.  QB64 gives me the option to click on the error to go to the error log but it is always blank.  That leaves me with no where to go. A real dead end.  Where do I start to find my problem in a couple thousand lines of code?

And why will code that failed to compile in one instance of QB64 compile in a different instance of QB64 (until a save)?  I have demonstrated this to my self several times.  In spite of this baffling issue, I do like QB64.

Darrell




















qb64.  I have

Offline CBruce

  • Newbie
  • Posts: 1
    • View Profile
Re: C++ compilation failed
« Reply #8 on: April 17, 2020, 08:15:58 pm »
Darrell, it would be good to check the contents of the .BAS file after the save. If you end up with bytes in the file that the transpiler/compiler can't handle, that could be the problem.

Obviously, look for control characters, etc. ... but also check the EOL characters in the file. In the past, most of the linux text files I've dealt with had a single LF character as EOL, whereas Windows text files are normally a CRLF duo of characters as EOL. I've seen problems when a file's EOL is totally different like this ... but I've also seen problems when only *some* of the line endings in the file are different.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: C++ compilation failed
« Reply #9 on: April 18, 2020, 01:07:07 pm »
Hi it runs ok on my Kubuntu 16.04
Programming isn't difficult, only it's  consuming time and coffee