Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
Regular expressions will not work on gcc4.8 based on what I found out.
During cross compile I encountered run time errors with regards to regular expressions.
Do you know other ways how can i work with regex at gcc4.8?
I am thinking of creating my own but I wander if there is already available that can be use.
GCC 4.8 is really old (and no more maintained in 2020).
Consider updating it -in October 2020- to GCC 10 (whose source code you could compile) and read documentation about invoking GCC and using GDB. I suggest compiling with g++ -Wall -Wextra -g using a recent GCC.
Read at least the C++11 standard n3337 and a good C++ programming book and more about the #include <regex> standard header.
On Linux and POSIX systems, you could use regex(3). The source code is available, since open source (in e.g. the GNU libc or the musl-libc) and with permission you can adapt it to your working context.
You could also use Qt or POCO. Both have some regular expressions facilities and are open source. So you can study their source code implementation of regular expressions and their relation to push down automata. Read also about recursive descent parsers and consider using parser generators (if allowed) such as GNU bison, flex, or ANTLR. If performance is a major concern, consider using (with permission) code generating libraries like libgccjit, asmjit, GNU lightning, tinycc.
Of course, read the Dragon book. It explains the basic concepts for regular expressions. Read also recent papers to ACM SIGPLAN conferences.
If your management requires specifically GCC 4.8 (I would consider changing jobs with such a stupid requirement - since cross compiling GCC 10 is quite easy, and GCC improved a lot in five years), you should at least ask permission to compile some existing regular expression open source libraries (you'll find many of them on github or gitlab), or in boost.
Consider of course asking permission to use a recent Clang compiler (you could compile it from its source code, since it is open source), the Clang static analyzer, and perhaps Frama-C++, and to read this draft report. See also the CHARIOT and DECODER European projects.
PS. Cross-compiling GCC 10 takes one or two days (if you are a newbie). Writing your regular expression library could take you several weeks.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm a starter in C++. I'm still confused about the flags in my makefile.
-c. -o. -Wall. -g. -std=c++0x.
Can any one tell me what all these common flags do?
Only the last flag (compiler command option) is very compiler-specific. The first three or four have been de facto standard since, well, the early or mid 1980s, I think. Of course there’s no guarantee that any particular compiler will understand them, but they’re not uncommon.
Note: while Visual C++ accepts the - flag prefix notation, it is usually used with / as flag prefix, since that’s the common convention in Windows.
-c
Compile only, don't link.
-o
Specifies an output file, e.g. executable. Unfortunately deprecated
for Visual C++ compiler. With Visual C++ use e.g. /Fe.
-Wall
With g++ all practical warnings. With Visual C++ all warnings including all sillywarnings, and that's a bunch!
-g
Generate debug information. Supported by many compilers but not Visual C++.
Then,
-std=c++0x
is a g++ compiler-specific option that specifies sort of C++11 standard. As I recall the difference from -std=c++11, for newer compiler versions that accept both, is that the former still permits some g++-specific language extensions.
Those are not "c++ flags", those are flags for a compiler, presumably it's g++ from the gcc suite.
All those flags are documented on both the online and the offline docs, the offline docs are probably easier to browse for a beginner due to the fact that you can just open the pdf in a viewer and use the search engine to search for a word.
This are the manuals for gcc.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
The community reviewed whether to reopen this question 1 year ago and left it closed:
Not suitable for this site
Improve this question
I have some questions about C++:
Is C++ an open-source project like Linux, Qt, ... or not?
Which community maintains C++ and develops new versions?
If it is open-source where can one access the source code for C++
implementations?
C++ itself is only a description what the language should be,
without a definite implementation.
Anyone can make his own implementations (compiler etc, runtime library, ...)
and call it C++ if it fits to the description.
http://www.open-std.org/jtc1/sc22/wg21/
And if a implementation is open source depends on the creator.
Examples of implementation (parts):
GCC/G++, libc/libc++, clang (++ too), Visual studio and MS´ runtime...
C++ is developed by an ISO standard committee. There's also a C++ foundation that runs a web site you might want to read.
C++ itself is a language, not a specific implementation, so there's no source code available for the standard/language itself.
Some C++ implementations are open source (e.g., Gnu and Clang).
C++ is a code standard defined by the International Organization of Standardization (ISO). There are many different implementations of the language, but they all tend to conform to C++11. Unlike Linux or Qt, C++ is just a standard, and to use any code written in the language you'll need a compiler. The major compilers (list from Wikipedia) are LLVM Clang, GCC, Microsoft Visual C++, and the Intel C++ Compiler.
C++ revisions are dealt with by ISO, and are influenced primarily by the maintainers of the above four implementations.
Clang and GCC are both open-source, I'm sure if you poke around you can find other conforming compilers but those are the two most used.
C++ is an ISO standard. There are many implementation of compilers (and linkers). GCC is an open source project of many compilers one of which is the C++ compiler, g++:
http://gcc.gnu.org/projects/cxx0x.html
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I don't intend this to be an opinion question and I am deliberately avoiding the word "best" for that reason. To frame my question differently;
Is there a fully C++11 compatible Open Source and free (as in free speech, beer and lunch, not as in Express, Lite, Demo, etc.) IDE that provides stable syntax and error highlighting a la IntelliSense, that works out of the box with C++11, or at least with a minimal, easy to follow amount of work?
I am asking this question because I really like the VS2012 environment but have become frustrated with the lackluster degree of C++11 compatibility, and my license is due to expire anyway.
Have you tried the "Visual C++ Compiler November 2012 CTP" update? It adds support for several features (most notably variadic templates) to VC11. The library is not there, and this compiler update is not considered production-ready, but I've found it to be great for working on my projects and using C++11 code till the final product comes out.
Also, I have used Qt Creator (quite independent from the Qt toolkit) for GCC-based C++11 development and it's a great IDE.
First: it's not (mainly) the IDE that needs the C++11 Support, but the compiler. That being said - here are some options:
it is possible to integrate clang into VS2012 (check here: https://github.com/ishani/ClangVSx)
You can use any IDE that supports MINGW as compiler (Windows-GCC-Port) e.g. Eclipse CDT, QT Creator, Code::Blocks, DevCpp
You can use any IDE that supports Clang as compiler (e.g. Code::Blocks)
According to http://www.codelite.org/LiteEditor/ClangIntegration, you can configure codelite to use Clang for code completion vs. gcc. So depending on the IDE, the compiler might provide things like code completion.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Does documentation for C++ exist in Linux? I want something like the man pages of C.
For example, docs for string, stl, iostream, ifstream, etc.?
If you use the "normal" libstdc++ shipped with g++, its documentation is available online here.
Most Linux distributions make it also available offline as a particular package; for Debian-derived distros, for example, it's libstdc++-6-<version>-doc (e.g. on my Ubuntu machine I have libstdc++-6-4.4-doc installed). In general the documentation will be put somewhere like /usr/share/doc/libstdc++-6-4.4-doc.
This about implementation-specific documentation; for compiler-agnostic docs, instead, many sites on the Internet provide reference documentation for the standard library.
One of the most referenced is nowadays cppreference.com, that is actively maintained, tends to be very faithful to the standard and shows well the differences between the various standard versions; it can be a bit intimidating to newbies, though.
cplusplus.com historically was one of the most used (especially as it is very "liked" by search engines), but was known to contain several errors or incorrect simplifications; I don't know if it got any better in these last years.
Also, the C++ library section on msdn.microsoft.com has got much better in the recent years in separating what are the Microsoft-specific details from what the standard dictates.
Finally, if you want precision up to the paranoia, the ultimate normative document is the C++ standard, that is sold from ISO, ANSI and BSI (for a quite high price); there are however several drafts available for free, which are more than good enough for "casual use".
In Ubuntu, after installing libstdc++-6-x.x-doc, these docs are available via man, examples(libstdc++-4.8-doc)
man std::list
man std::weak_ptr
man std::ios_base
To get a list of these entries, use
apropos -r '^std' | vi -
This command gets all man entries beginning with std and sends them to vi.
==========
Update: as of libstdc++-4.8-doc, the prefix is std:: instead of std_.
cppman is a C++ manpage formatter available on Github.
On request, it generates manpages from cplusplus.com, and it is quite good at it. Your manpage viewer will be cppman instead of man, though, and you still need to be online.
Install the man pages:
$ sudo apt-get install libstdc++6-4.4-doc
The C++ standard library is documented at http://www.cplusplus.com/reference/. Your implementation might bring it's own documentation. For example libstdc++ from the GNU Compiler Collection is documented at http://gcc.gnu.org/onlinedocs/libstdc++/. Look into the source distribution of the specific library to find out if and where the documentation is.
On Ubuntu an offline copy of the excellent documentation at http://cppreference.com is available in the packages cppreference-doc-en-html (HTML) and cppreference-doc-en-qch (Qt Help format).
To install:
sudo apt-get install cppreference-doc-en-html
On RHEL 6 the package libstdc++-docs installs documentation in /usr/share/doc AND man pages:
sudo yum install -y libstdc++-docs
now I can:
man std::string
for example.
You'll want to pay close attention to the version of your compiler; on recent linux distributions you're likely using g++ v4.3, or maybe v4.4, but some of the newer C++0x features are in g++ v4.5, so depending on the features you are playing with, you may run into issues on that front.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I'm looking for a tool which can generate a Makefile for a C/C++ project for different compilers (GCC, Microsoft Visual C++, C++Builder, etc.) and different platforms (Windows, Linux, and Mac).
Other suggestions you may want to consider:
Scons is a cross-platform, cross-compiler build library, uses Python scripting for the build systems. Used in a variety of large projects, and performs very well.
If you're using Qt, QMake is a nice build system too.
CMake is also pretty sweet.
Finally, if all else fails...
Try Automatic Makefile Generator.
It has support for the following compilers:
Borland 3.1
Borland 5.0
Borland 5.0, 16 bit
Borland 5.5
Borland 5.6
Borland 5.8
CC
GNU g++
GNU g++, dynamic library
Intel 5, 6, 7 for Linux
Intel 5, 6, 7 for Linux, dynamic library
Intel 5, 6, 7 for Windows
Intel 8,9,10 for Linux
Intel 8,9,10 for Linux, dynamic library
Intel 8,9 for Windows
Intel 10 for Windows
Visual C++ 5
Visual C++ 6, 7, 7.1
Visual C++ 8
Open Watcom
Watcom 10A
Watcom 10A, 16 bit
I've used Bakefile before with some success. It's fairly simple and seems to work well.
CMake is the only tool which can actually generate real Visual Studio projects (i.e., not "Makefile"-projects which call out to an external tool), and which automatically recreates the projects when the build input file (CMakeLists.txt) changes.
SCons performance issues are well-known and a thoroughly debated topic on the SCons mailing lists.
I would vote for OMake. It fixes all complains I had with GNU make:
it's a full-blown language.
uses MD5 instead of timestamps.
provides a minimal shell which implements the most useful Unix commands on all platforms: find, sed, AWK, etc.
works with either Unix or DOS style pathnames.
extensively documented.
supports parallel builds.
fast.
I'll also second CMake. I've been using it for quite a while on a multi-platform project and I'm very satisfied with it.
Automatic generation of (M|m)akefiles makes me worry about what you're trying to do here.
Do you understand what goes on under the covers when you type make? Or gmake? I'm only asking because if you don't when things break, such as new code changes not being incorporated into the build, you'll have difficulties trying to work what has happened.
To start to understand make, can I suggest having a read of "Managing Projects with GNU Make" by Robert Mecklenberg. The early chapters cover how make is working. Getting your heard around the fact that make is backward chaining is one of the biggest things you can do.
If you don't, and your system appears to work, then you'll be, to use The Pragmatic Programmers' term, "programming by coincidence". (-:
BTW Great articles available at their site! And I'm not involved with them. YMMV. Yada-yada...
One issue to consider is do you want a "makefile" creator or a replacement build system? The problem with replacement build systems is that you typically don't get good IDE integration for platforms whose users expect this (Visual C++).
If you do want a makefile creator instead of a replacement build system, take a look at MPC. It's free and open source.
A recent addition to the list of make replacements is waf. From personal experience, SCons does the job pretty well.
I am working on a similar Makefile auto-generator projection called CodeMate, developed by using Ruby. Maybe it is not that mature for large applications right now, but I will keep working on it to make it better.
Users should not need to edit any configuration file to build the software, or at least it is supposed to be. The learning curve should be minimized.