Given the following:
large project with thousands of C++ source files
no common header file (no one header that's included in every source file)
said project is compiled with g++ and managed by make
Is there any way to include a definition (e.g. macro) into every compilation unit without modifying every source file to include a new h...
Hi, I've gotten fed up with MSVC++6 and how everyone is always telling me that it's a crappy compiler and such..
So now I've decided to try to use vim plus g++ and makefiles. Anyway here's my problem.. I have the following makefile
# This is supposed to be a comment..
CC = g++
# The line above sets the compiler in use..
# The next li...
I am redirecting the g++ compiler output(both stderr and stdout) to a file on linux. But it is creating an empty file.
I read in some other post that stdout is not flushed after every line. Thats ok, but what about stderr. In my case there are compilation errors running several screens. So, I am interested in stderr output. There is no ...
I have recently discovered that I can make windows executables with g++ that have no external dependencies, as long as I use the -mno-cygwin flag. My impression is that the compiler uses MinGW libraries instead of cygwin.
Is this an effective way of using cygwin to build binaries without gpl licensing issues?
Are there any technical si...
If I statically link an executable in ubuntu, is there any chance that that executable won't work within another distribution such as mint os? or fedora? I know processor types are affected, but other then that is there anything else I have to be wary of? Sorry if this is a dumb question. Thanks for any help
...
I am trying to execute my first "Hello World!" in C++. I am using Windows XP, and I have installed cygwin, in which the g++ C++ compiler is installed. I have written a small hello-world program, and saved it in hello.cpp. From the command prompt I write:
g++ hello.cpp
But I get:
'g++' is not recognized as an internal or extern...
I have installed Eclipse and CDT (to use C/C++ in eclipse CDT is needed), as well as installing Cygwin so that I can compile my files.
In environment variables I've set Path to include the following: "C:\cygwin\bin;"
g++, make and GDC are all installed via Cygwin. I made sure of this by searching for them in the bin folder - they're al...
Hi,
I'm compiling and linking a cpp file against a pre-compiled library, and I'm getting an "undefined reference" error.
Firstly, this is the command (the library in question is quicknet3, the program I'm compiling is trapper):
g++ -w -g -I. -g -O3 -pipe -Wall -I/home/install/x86_64/include/quicknet3 -L/home/install/x86_64/lib -lqui...
It had been a while since GCC caught me with this one, but it just happened today. But I've never understood why GCC requires typedef typename within templates, while VS and I guess ICC don't. Is the typedef typename thing a "bug" or an overstrict standard, or something that is left up to the compiler writers?
For those who don't know w...
I have a function declared like so:
template <typename T>
T read();
and defined like so:
template <typename T>
T packetreader::read() {
offset += sizeof(T);
return *(T*)(buf+offset-sizeof(T));
}
However, when I try to use it in my main() function:
packetreader reader;
reader.read<int>();
I get the following error from ...
Is there a site that provides a great list of common C++ optimization practices?
What I mean by optimization is that you have to modify the source code to be able to run a program faster, not changing the compiler settings.
...
How do you port C++ programs with makefile made from GNU C++ in Linux to Visual C++?
...
How come I get this error when compiling with the -m32 argument?
unrecognised emulation mode: 32
I'm compiling using g++ on an x86_64 machine. It happens in one project, but not the other... Any hints?
Note: I'm using Eclipse CDT, so perhaps this is an IDE specific gocha?
Rephrased question
Perhaps a better question would be: Wh...
Objective-C v2.0 (which is what the mac uses) got a new feature, Garbage Collection. I'm a kid on a Linux PC (Ubuntu in case your wondering). So my question is, using the gcc/g++ compiler is Objective-C Garbage Collected?
...
Good evening :)
I'm playing around with g++ and makefiles. I've gotten to this point:
foo.h:
#ifndef _FOO_H_
#define _FOO_H_
#include "bar.h"
class foo {
private:
bar something;
public:
bool start();
bool stop();
};
#endif // _FOO_H_
Foo.h is eventually included in my main cpp file so I can set things in motion by cal...
I'm trying to create something similar as this code found at the boost.asio examples.
socket.h:
class some_class {
private:
...
boost::asio::io_service io_service;
public:
some_class() {
/* This stuff isn't used in the example...
...but it doesn't change anything... */
io_ser...
I just moved some code from one platform to another which required a change in compiler versions. Two of the utility sources caused linking problems with undefined symbols, for this example call them Foo.c and Foo.h.
Everything was compiling and linking fine with g++ 3.4.2 and I figured the switch to g++ 4.1.2 would be a no brainer. W...
I want to write a macro in C that accepts any number of parameters, not a specific number
e.g.
#define macro( X ) something_complicated( whatever( X ) )
where X is any number of parameters
I need this because whatever is overloaded and can be called with 2 or 4 parameters.
I tried defining the macro twice, but the second definiti...
Some background:
As a personal project, I've been developing a kernel in c++. Things are going well, in fact I have very good support for much of c++ available in kernel land (I've implemented nearly the entire libc and libstdc++).
One of the more difficult and compiler specific things is RTTI and exception support. For now I'm disabli...
I have a function which shall return a char*. Since I have to concatenate some strings, I wrote the following line:
std::string other_text;
// ...
return ("text" + other_text).c_str();
I know that I could avoid the question naming the string I want to return. I just want to take the chance to make a more general question:
is it safe ...