Where are the man pages for C++? [closed] - c++

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.

Related

Regular expression implementation that can be use for gcc4.8 [closed]

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.

c++ IDE on usb? [closed]

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 last year.
Improve this question
is there any c++ compiler i can put on a usb or external harddrive and use it on any other computer? the school computjers in my library dont have an ide... or a compiler installed...
P.S the school computers are very tight on securty. i cant even download things from the internet, no websites like facebook, so can i install it on one of the computers? or can i just run it as the actual executable file and run it straight from my usb?
there are several computers with windows 7, and 3 imacs
I'd try Eclipse. And if it doesn't work straight away, try one of those USB-stick program-hosting softwares like U3 (it comes on some Sandisk thumb drives).
Code::Blocks can easily be made portable by setting custom environment variables, described here
At the back-end, C::B can use mingw, which doesn't require any specific install information other than a few environment variables. (namely PATH). These can be set temporarily using SET PATH=%PATH%;./mingw/, which should be possible without elevated privileges.
You might try some of the tools at portableapps.com. They're a group that modifies open source software to run off of USB sticks. I've used their versions of Notepad++, Gimp, and Filezilla for years.
In particular, maybe look at they're development tools: http://portableapps.com/apps/development
It looks like they even have some programs to make other apps portable as well, which you might try with Eclipse, as John suggested. (I think Eclipse may also just run off a USB stick without any modification.)
Dev-C++ might be a good choice if you only use Windows.
If you want an IDE that works in both Windows and Mac, you can choose Emacs, which is a very powerful text editor and is a part of the GNU project. But as it's only a text editor, you will need to download the C++ compiler yourself. MinGW might be a good choice in Windows. Since I have never used a Mac, I cannot give you more suggestion for the Mac environment. But as it's a Unix based system, I guess it has a C++ compiler itself.
What you're looking for is a portable c++ ide. Google gave me the following:
devcpp-portable
Netbeans portable config
But go through google to find more
There is portable code blocks.

Is there any reference for LINUX and cross-platforms APIs? [closed]

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 4 years ago.
Improve this question
First, I develope C++ applications that invokes OS APIs (like CopyFile, GetModuleFileName, ... in Windows). I don't want to develope GUI applications. my applications work like a SERVICE or CONSOLE in WINDOWS.
Second, Standard C++ Libraries doesn't provide advance programming features like Threads, Network and even File Management.
In MS Windows platform, MSDN provides very good reference for C++ programmers that want to work with Windows APIs.
For example in this page: "EncodePointer Function", MSDN describes that EncodePointer is an API that "Minimum supported client is Windows Vista, Windows XP with SP2", "DLL
is Kernel32.dll" and ...
Now I want to start LINUX programming. I found too many libraries and references, some work in Fedora, some work in Ubunto, some work in SUSE and...
BUT I want ONE LIBRARY that works in ALL LINUX distributes. Something like Windows API that works in ALL WINDOWSes.
Is there any library that I write code once for linux? and don't worry about other distributes of LINUX?
Thanks.
There is a standard that should work (other than minor bugs or a few things that aren't implemented) across most Unix-type systems, including all Linux distros, the BSDs, Solaris, AIX, and so on. It's called POSIX or the Single Unix Specification; they are both basically equivalent, but published by different groups. You have to pay for POSIX, but the Single Unix Specification is available online for free.
Note that some of POSIX is implemented on Windows, and there are systems like Cygwin or Windows Services for Unix/Subsystem for Unix Applications to add more complete support of POSIX to Windows, though these generally require downloading separate libraries and runtime components, and can sometimes be frustrating work work with as things like line endings and file permissions work differently in Windows and Unix based APIs.
Beyond POSIX, Linux and glibc implement some system calls and library routines of their own, so if you're only interested in running on Linux and not other Unix-like operating systems, you have a somewhat richer API to work with. If you know what call you're looking for, you can use the man command on Linux to find documentation on it; system calls (like fork or execve) are documented in section 2, and library calls (like printf) are documented in section 3. Man pages can also be found online in a variety of places, such as the Linux man-pages project . There is also a complete online manual for glibc, and an online reference of Linux system calls.
If you want a book on the topic, The Linux Programming Interface by Michael Kerrisk, the guy who runs the Linux man-pages project, is supposed to be quite good.
For a reference on what should be supported across all distributions of Linux, you can take a look at the Linux Standard Base. Like POSIX, this is generally mostly supported on most distributions of Linux; there will be some minor deviations here and there, but on the whole it should tell you what's expected of a modern Linux. The Linux Standard Base mostly references other standards, like the Single Unix Specification/POSIX or the Filesystem Hierarchy Standard, but describes some Linux-specific functionality itself.
Yes, you want the POSIX library.
Leaving the fact that each version of Windows provides a slightly different API aside for the moment, each Linux distribution supports programming to glibc, the documentation of which is contained in section 2 of the man pages.
Qt is a good framework that can be used to develop once and compiled for all platforms including Windows.
Try BOOST
http://www.boost.org/

Setting up a Programming Environment in Linux [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I recently started using Linux as my primary OS. What are the tools that I will need to set up a complete programming environment in Linux for C and C++?
Standard stuff:
The compiler tools, gcc, gdb, etc.
Some sort of editor/IDE (emacs, vim, eclipse)
Profiling tools
Source Control (SubVersion, git, etc)
Language specific tools, like easy_install for python (you said C/C++, but the same goes for everything)
A web server maybe? Apache, Lighttpd, nginx
Any libraries you'll be using. Are you doing kernal hacking? Driver development? opengl?
Among others you should also have gprof and valgrind ( or something in it's class ).
Vi (or emacs), gcc , make
Tradiationally unix development is more commandline than ide. There are very good IDEs, the main ones are probably eclipse and kdevelop
It depends on your definition of "Complete programming environment", and whether you are using C, C++, or both (C/C++ is an awful term that shouldn't be used. Either it's C, or C++).
If you are looking for an IDE, Eclipse/CDT is the most highly-recommended one from my experience (I don't actually use any IDE, so I can't offer first-hand advice).
If you can cope with command-line control (and in the end I find it makes things easier to do and doesn't take a whole lot of getting used to), a simple text editor with highlighting will suffice. I prefer KATE (part of KDE), as it features a built-in terminal as well as many features you would expect from an editor inside an IDE, like code folding and regex search/replace.
Many people also recommend Vim or Emacs, both of which are probably available through your distro's repositories. (Eclipse is probably available too, but in my experience the CDT is confusing to install via packages. YMMV). They are both ancient editors; and there is a powerful holy war between the two, so I won't get involved.
Your compiler should probably be GCC - on a Debian system, installing the g++ package as well as build-essential should be enough to get C++ going (build-essential should contain the gcc package required for C development). Whatever your distro, GCC is probably easily available or else already on your system.
Seconding swilliams, I'd say the basics are:
an editor or IDE (I use vim),
a compiler (almost certainly gcc)
make, or maybe some other similar tool like ant if you want
a debugger (almost certainly gdb)
source control (I use subversion)
Standard unix utilities like grep and diff, but you have those already
Other than that, I'd say install as you go. Linux is more about little utilities that each do one thing than monolithic development environments that do everything. So if you find yourself needing something, you can always just install it, be that thing a memory profiler, a documentation generator, a bigger/smaller/more different editor, et cetera, et cetera.
What distribution are you running?
In Ubuntu or any Debian based distribution you can issue the following command to install all the necessary tools.
sudo apt-get install build-essential
From there you can install your SCM solution of choice and an IDE if you prefer or just use your favorite text editor.
The simplest of answers is an editor (take your pick - at least one is already on there) and gcc/g++.
If you want an IDE, there are a slew of questions related to that on SO :) (including this one C++ IDE for Linux?).
Kdevelop is a well regarded and well written IDE for Linux, installing it should get you every other tool you might want to develop with installed as well and and IDE to go with it.
By "every other tool" I mean gcc, grep, diff, autoconf et al should be grabbed by the package manager and installed at the same time, but I could be wrong. I don't have a standard distro on hand to test that with.
Personally, I use vim, but I have used kdevelop in the past.
vim/vi is handy because you know that some form of vi is always available on every unix platform.
I have to correct my post. I just looked at the package requirements for kdevelop on ubuntu... it does NOT appear to require gcc and install it automatically
If you want something very easy to use, with ability to import visual studio projects, and a feel much like VS, give Codeblocks a try. Its quick ( since its not Java based ) and in general works well.
Another great utility that you can use are *nix man pages. Each function in the C library has an associated man page.
For example:
man printf
man strncpy
...
I took an old windows laptop with a dead hard drive and
replaced the hard drive then installed Ubuntu (linux / debian
all in one handy release) on it. I had to burn the ubuntu
installation files onto a cd first on another working computer.
Here's where I got my linux from (complete with desktop gui, very
easy to install, lots of programs to use, it was my first linux
but not my first unix):
http://www.ubuntu.com/getubuntu/download
Then i installed Netbeans for my integrated development environment (IDE)
altough I am using it for java -- but it comes with c++ support as shown below:
http://www.netbeans.org/features/cpp/
I also installed mySql, you didn't ask, but that is another key component
that completes my development environment.
Good luck to you.
On most distros, everything you need will be installed by default (very few don't include gcc, they all include some kind of editor). I generally do my development in Vim (or gVim, which is the graphical version -- the best of both worlds). For those times when I'm feeling the need for a "real" IDE, Eclipse with the Vim plugin is really nice. It's almost like working in Vim, except you get the Eclipse stuff -- again, best of both worlds. The Vim plugin for Eclipse that I'm using is not free, however :( I believe there is a free one, but the last time I tried it, it wasn't very good.
Personally I use Ubuntu w/ Eclipse CDT. Eclipse is what most people might think of as a Java IDE, but CDT is a set of extensions that really tune it for C/C++ development. It's smart enough to figure out what toolset to use (MacOSX GCC vs Linux GCC, for example).
Eclipse CDT Website
For best results, currently the 6.0 JRE for Ubuntu seems to have problems with recent Eclipse versions, so what I did was remove the 6.0 JRE and run:
apt-get install build-essential
sun-java5-jre sun-java5-bin
Then grab the latest Eclipse from the website, unpack it in a directory.
As a final touch, edit the eclipse.ini file that comes with Eclipse and add this line to it:
-XX:CompileCommand=exclude,org/eclipse/core/internal/dtree/DataTreeNode,forwardDeltaWith
This will further stabilize the app, making it as rocksolid as Windows or Mac.
If you prefer commandline tools over GUI tools, some ones I use regularly:
CMake -- Portable build tool. It's easy to use and can output a variety of formats like Makefiles or Visual Studio files.
apt-get install cmake
Vim -- VI improved, if you want a text editor with some bells and whistles. Otherwise, just use 'nano', which comes with Ubuntu.
apt-get install vim
Twe options, you must make your decision now and never look back, or risk being burned at the stake:
a. Emacs
b. vi(m)
Do not listen to any rational arguments before choosting... listen to the light inside yourself...
Install a lot of bell a whistles for the editor you choose, vi is usable but no fun.
vim is fun, but vim with extras is great.
(And the same is true for Emacs even if that means installing tetris and a doctor ;-) )
/Johan
Two must haves are guake and pithos. I cant see how any one can have a list of dev tools without these.

Is there a good tool for Makefile generation? [closed]

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.