Author Topic: C++11 needed for a library  (Read 209 times)

Offline Aureal

  • memes
C++11 needed for a library
« on: June 23, 2018, 02:20:01 AM »
So, I made a new C++ library for QB64 that needs C++11 support, but, it seems that the command line arguments for the embedded c++ compiler do not include "std=c++11". The log goes like this:
Code: [Select]
In file included from c:\users\zurio.000\desktop\os\qb64\internal\c\c_compiler\bin\../lib/gcc/i686-w64-mingw32/4.7.1/../../../../include/c++/4.7.1/regex:35:0,
                 from ..\\temp\\..\\..\\regex.h:2,
                 from ..\\temp\\regsf.txt:1,
                 from qbx.cpp:987:
c:\users\zurio.000\desktop\os\qb64\internal\c\c_compiler\bin\../lib/gcc/i686-w64-mingw32/4.7.1/../../../../include/c++/4.7.1/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
compilation terminated due to -Wfatal-errors.
🅱ey 🅱sauce 🅱ichael 🅱ere

Offline RhoSigma

  • Out of Time !!
Re: C++11 needed for a library
« Reply #1 on: June 23, 2018, 05:19:26 PM »
Hi Aureal,

reading the details of that Compiler error message it seems you're trying to implement some kind of RegEx library.

I've done that in my GuiTools Framework project too, and had the same problem. You can change the command line arguments for the compiler by editing the file internal\c\makeline.txt (SDL) or internal\c\makekline_XXX.txt (GL), where the XXX is either win, lnx, mac for the respective OS.

Instead of -std=gnu++11 you should use the more general option -std=gnu++0x, which does the same.
However, be aware that the regex support of the compiler currently shipped with QB64 is very poor and causes
a lot of crashes.
You can learn about my experiences by downloading GuiTools from my signature and read the comments in the file QB64GuiTools\dev_framework\GuiAppFrame.h
 

Offline Aureal

  • memes
Re: C++11 needed for a library
« Reply #2 on: June 23, 2018, 06:40:31 PM »
Hi RhoSigma,

it seems that -std=gnu++0x is not working, I've sent all the technical information to Felippe, maybe he can help. It would be nice if qb64's internal c++ compiler had c++11, 14 and 17 support, I think that the gcc version that we're using is old (timestamps date 2012), and therefore its c++11 implementation is not bug-free, maybe the core c++ compiler should be updated? I tried downloading a fresh new version of MinGW and then just stuck it in the "..\internal\c\c_compiler\" folder, which solved the c++11 problem, however, there were a lot of #include not found errors (which could be easily solved by moving them, or just modifying the common.h file, I think), so maybe this can actually be updated without breaking anything, giving us support for c++ standards up to std=c++17?
🅱ey 🅱sauce 🅱ichael 🅱ere

Offline RhoSigma

  • Out of Time !!
Re: C++11 needed for a library
« Reply #3 on: June 23, 2018, 07:41:02 PM »
Indeed, the compiler we're using is very old. I guess all the required work fixing #include errors and so for a more recent version made our QB64 developers to rather go with that old MinGW version as long as possible.
And to be honest, it works for now. You and me are so far (to my knowlege) the only people calling for C++11 support for their libraries/projects, so I think nothing will change that soon.

Re: C++11 needed for a library
« Reply #4 on: June 24, 2018, 05:28:00 PM »
Hi Aureal and Hi Rhosigma...
about c++ compiler used into QB64...
Are there any options of this compiler that can open the QB64 to the WorldWideSpreading?
In other words, functions IO ( like INPUT statement, INPUT# statement, INKEY$ and go on) don't  adapt this wonderful  QB64 to local setting about keyboard or ASCII/UNICODE table, and it seems that also Mouse input is indipendent from OS settings... so if I type some text using some keys or if I take input from a text file written in local language I got result as my pc and/or my OS was English/American.
Are there options to bypass  this bypass?

Thanks to read

Offline RhoSigma

  • Out of Time !!
Re: C++11 needed for a library
« Reply #5 on: June 24, 2018, 06:35:57 PM »
Hi TB,
the answer is NO, the C++ compiler is not responsible for char remapping between different languages/codepages.
The C++ compiler is just translating C++ code into machine code. Any ASCII/UNICODE remapping needs to implemented in the IO sub-system of QB64, one is _MAPUNICODE, but that's rather a poor function. To make QB64 a real UNICODE aware application a lot of construction work would be required under the hood.


Re: C++11 needed for a library
« Reply #6 on: July 01, 2018, 12:32:47 PM »
From what I had discovered during my tenure of working with the internal code of QB64, it was written in C not C++. There are major differences between the two languages. I tried upgrading the "compiler" package to C++ v11, but ran into many issues due to conflicts. I modified a few things in QB64, but the more I fixed, the more inconsistencies I ran into.

If I am not mistaken, I believe that Galleon stated that QB64 was written in C on QB64.net, that is still sadly down at this moment, but it's been a long time since I read that.