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

0 Members and 1 Guest are viewing this topic.

Offline Aureal

  • Newbie
  • Posts: 17
  • memes
    • View Profile
C++11 needed for a library
« on: June 23, 2018, 01: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: QB64: [Select]
  1. 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,
  2.                  from ..\\temp\\..\\..\\regex.h:2,
  3.                  from ..\\temp\\regsf.txt:1,
  4.                  from qbx.cpp:987:
  5. 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.
  6. compilation terminated due to -Wfatal-errors.
  7.  

Offline RhoSigma

  • QB64 Developer
  • Forum Resident
  • Posts: 565
    • View Profile
Re: C++11 needed for a library
« Reply #1 on: June 23, 2018, 04: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
 
My Projects:   https://qb64forum.alephc.xyz/index.php?topic=809
GuiTools - A graphic UI framework (can do multiple UI forms/windows in one program)
Libraries - ImageProcess, StringBuffers (virt. files), MD5/SHA2-Hash, LZW etc.
Bonus - Blankers, QB64/Notepad++ setup pack

Offline Aureal

  • Newbie
  • Posts: 17
  • memes
    • View Profile
Re: C++11 needed for a library
« Reply #2 on: June 23, 2018, 05: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?

Offline RhoSigma

  • QB64 Developer
  • Forum Resident
  • Posts: 565
    • View Profile
Re: C++11 needed for a library
« Reply #3 on: June 23, 2018, 06: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.
My Projects:   https://qb64forum.alephc.xyz/index.php?topic=809
GuiTools - A graphic UI framework (can do multiple UI forms/windows in one program)
Libraries - ImageProcess, StringBuffers (virt. files), MD5/SHA2-Hash, LZW etc.
Bonus - Blankers, QB64/Notepad++ setup pack

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: C++11 needed for a library
« Reply #4 on: June 24, 2018, 04: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
Programming isn't difficult, only it's  consuming time and coffee

Offline RhoSigma

  • QB64 Developer
  • Forum Resident
  • Posts: 565
    • View Profile
Re: C++11 needed for a library
« Reply #5 on: June 24, 2018, 05: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.

My Projects:   https://qb64forum.alephc.xyz/index.php?topic=809
GuiTools - A graphic UI framework (can do multiple UI forms/windows in one program)
Libraries - ImageProcess, StringBuffers (virt. files), MD5/SHA2-Hash, LZW etc.
Bonus - Blankers, QB64/Notepad++ setup pack