Tag Info

Hot answers tagged

14

You're right that you'll end up with the same executable at the end (albeit with a different name); in the first case gcc will actually create a bunch of temporary object files that it removes after linking, versus the second case where you're making the object files yourself. The main reason to do things the second way is to allow for incremental building. ...


8

Every standard conforming compiler should come with STL, as it is part of the standard library. The first standard was finalized in 1998, so unless you are using a really old system, it should be available. All you need to do is use the proper #includes. #include <vector> std::vector<int> v;


7

Here is a breakdown of the command. First the original command, for reference g++ -Wall -I/usr/local/include/thrift *.cpp -lthrift -o something Now, for the breakdown. g++ This is the actual command command, g++. It is the program that is being executed. Here is what it is, from the man page: gcc - GNU project C and C++ compiler This is a ...


7

For developing C/C++ you need the gcc compiler, which is included in most Linux distributions or can be easily installed. There is not a default IDE: most people use their favorite editor (vim, emacs, Geany etc...) and there are IDEs like Eclipse or KDevelop available. C# can be done with Mono, but it is not fully compatible with .NET: check the ...


6

Use -mtune. -march is used to determine the allowed instruction set, whereas -mtune is to be used to tune performance of the code (as always, see man gcc). Depending on the precise CPU type, you might also consider values other than core2. And if you use a recent GCC version (at least 4.4, I think), you might best use native instead.


6

For external representations, UTF-8 is definitely the standard. Some 8-bit encodings are still strong (mostly in Europe) and some 16-bit encodings are still strong (mostly in East Asia), but they are clearly legacy encodings, on their slow way out. UTF-8 is standard not only on unix, but also on the web. For internal representations, there's no such ...


5

This has more to do with C and C++ than Unix, and as such belongs to SO. To answer your question, the <> indicates headers in the standard library and "" the libraries written specifically for the project. From the K&R: Any source line of the form #include "filename" or #include <filename> is replaced by the contents ...


5

Depends - if you actually develope kernel space drivers that use mutexes and semaphores you should give the patches a quick review. As developer that is your responsibility, no answer on a website will solve that issue. If you are mainly developing userspace software, these changes do not affect you, as you only wrangle with the kernel interfaces, which are ...


4

libstdc++ 3 is not the default libstdc++ anymore. You can still install it, though it is best to do so with your distro package util. I'm assuming your BOINC client is for your arch, x86_64, and not compiled for x86. The difference is significant in resolving dependency issues. Considering you are on a regular user account, you should theoretically be ...


4

This is just a partial answer, since your question is fairly broad. C++ defines an "execution character set" (in fact, two of them, a narrow and a wide one). When your source file contains something like: char s[] = "Hello"; Then the numeric byte value of the letters in the string literal are simply looked up according to the execution encoding. (The ...


4

On a Ubuntu system, you can install the c++ compiler along with common development libraries with the build-essential package. This is a meta package that depends on the following: libc6-dev | libc-dev, gcc, g++, make, dpkg-dev This is the base of what is needed for compiling C and C++. Other development libraries can be installed as-needed.


4

The Cross compiler article on wikipedia is quite good. Generally a cross compiler is a compiler producing code for a different kind of system than yours. Usually this means a different target hardware architecture, but it can also mean a different target operating system (or both). Theoretically you could combine these and use a cross-compiler on ...


4

preamble you probably don't want to invest time into preventing people from disassembling your code: instead focus on making your project better, so that once your competitors have figured out how you did feature X, your software already has feature Y... the reasoning is simple: if you have a dull project, then nobody will care to disassemble it and you ...


3

Stay with gcc compiler and Vim as an IDE. There are a lot of plugins for Vim that improves the experience in almost coding languages, but you should learn Vim first if you want to take advantage of that though. On the other side, I think just a few "firms" are naming "C#" and "Linux" in the same context.


3

If you just want to change the program's configuration, the typical method of doing that is to update its conf file, then send it a SIGHUP signal, which it is programmed to respond to by reloading its conf file ( see signal(7) ). As Coren said, you typically have the program store its pid in a file in /var/run when it starts so you can later send it the ...


3

Well, if no-one else is writing answer for this question (instead of valid comments), I'll do it. bootchart.org is tool for doing exactly this. Bootchart is a tool for performance analysis and visualization of the GNU/Linux boot process. There is rather good page explaining how it works: Bootchart - How it works?. In short, it's wrapper for normal ...


3

I'm sure there will be a difference in speed over a network, but I'm not sure it will be enough to make your decision. It may only be a minor annoyance from time to time. However, I would emphasize point number 1, especially for coding. Here are some things I use VERY often in vim when I'm coding: comment/uncomment blocks of code all at once (using block ...


3

If you trust the local machine not to be spoofing, both ifconfig and ip addr will give you the MAC address of the hardware. If you don't trust the local machine, neither ethtool, ifconfig, nor ip is going to provide you the information you need. Because there are very legitimate reasons for MAC spoofing (for example, hot-fail on ethercards) all the drivers ...


3

I typically will use xev to determine the key's scancode and then map it to whatever action I want using either xdotool or XBindKeys. xev $ xev | grep -A2 --line-buffered '^KeyRelease' \ | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p' After running the above xev command you'll get a little white window that'll pop up. You'll ...


2

Generally you should look for the documentation of a command in its man page: man g++. In the case of GNU software such as GCC, you'll usually find more complete documentation in info format, or in HTML on the software home page. C (and C++) compilers have a somewhat peculiar syntax that doesn't heed the usual conventions for options (options come before ...


2

You might find the OpenSUSE Build Service useful; there are packages in the devel:gcc project. I believe if you add the URL http://download.opensuse.org/repositories/devel:/gcc/openSUSE_11.2/ to your YaST configuration, you ought to be able to install those packages. (Though the status on the website looks broken, I wonder how long that'll be..) All that ...


2

Taglib is quite feature rich. It comes as C++ lib without dependencies to Qt or KDE libs. A C API is bundled (and there are a lot of other languages bindings available). A lot of projects (like amarok, juk, vlc ...) use this library. The homepage contains some claims some advantages of taglib over id3lib (mainly performance).


2

Run gcc -M to generate the list of header files used by a given source file, or gcc -MM to omit system headers. The output is in a makefile format, since the option is intended to generate the build dependencies of that source file. There are ways to tweak the output format, see the available preprocessor options in the GCC manual. The default output looks ...


2

gcc is both a C and C++ compiler. It will look at the file's extension and process accordingly. g++ is only a wrapper that calls gcc g++ is installed with the gcc package in Arch gcc file.C # uppercase .C (or .cpp) will process as C++ gcc file.c # lowercase .c will process as C


2

You can develop with the Qt SDK on all the distros where it is available (and compile the open source edition often enough when it's not directly packaged, provided you can use that license). What the primary desktop environment is based on is largely irrelevant (you could develop non-GUI Qt apps on a headless server if you felt like it). What you can ...


2

All programs receive an array of strings as its arguments. In C++, the arguments are the argv parameter of the main function. The first element of that array is the name of the program, the others are the arguments that you pass. $ cat foo.cpp #include <iostream> int main (int argc, char *argv[]) { for (int i = 1; i < argc; i++) ...


2

The message already installed and latest version is referring to the latest version of the RPM (binary package) for the version of Fedora. It appears that you are using Fedora 12, which is quite outdated. Your best course of action is likely to upgrade to the latest version of Fedora first, then you will have a more recent version of GCC available (4.7.2). ...


2

There are effectively two main distributions (not trying to disparage anyone, just pointing out this is becoming a defacto standard). Debian RedHat From Debian, the following are derived (directly or indirectly): Ubuntu Mint and many more... From RedHat, the following are derived (directly or indirectly): Fedora Mandriva CentOS and many more... ...


2

OpenSuSE Build Service supports automatic build for many distributions (opensuse, ubuntu, ...). I heard that svn (or git) integration projects exist but I never used them. P.S. osc can be fully controlled by command line, so you could easily write an svn post commit hook (or git equivalent) to start the compilation.


2

In Debian-based distributions (including Ubuntu), use dpkg -S uXlib.h to find out, from which package a file named uXlib.h comes from (if that package is installed, it will find it). If that package is not installed, you might want to install apt-file as described here: http://www.debianhelp.co.uk/findfile.htm. I believe that your file should be in some ...



Only top voted, non community-wiki answers of a minimum length are eligible