g++

Problem with gcc tracker/make/fork/exec/wait.

This is a most singular problem, with many interdisciplinary ramifications. It focuses on this piece of code (file name mainpp.c): #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int status; if (fork()) { FILE *f=fopen("/tmp/gcc-trace","a"); fprintf(f,"----------------------------------...

G++ 4.4 compile error, lower versions works

Hello, I have my program written in C++ and it is can be successfully compiled on Ubuntu 9.04 with g++ 4.3.4 and Solaris OS with g++ 3.4.3. Now I have upgraded my Ubuntu to version 9.10 and g++ to version 4.4.1. Now compiler invokes the error in STL. /usr/include/c++/4.4/bits/stl_deque.h: In member function ‘void std::deque<_Tp, _Alloc...

g++ linking issue

I have a dependancy library (libfcgi) that I compiled with g++ (GCC v4.4 MinGW) using the following calls: g++ -Iinclude -c -O2 *.c ar rcs ../libfcgi.a *.o Now, my main project is built like so: g++ -Idependancies\libfcgi\include -Ldependancies -O2 -lfcgi *.cpp g++ apparently finds libfcgi.a, but yet it fails to link to the...

g++, R_X86_64_32S : what is it ?

Hello. I write a 3D engine in C++ with OpenGL. I usually work on this project on my archlinux 64 bits, but on theese holidays I do on a 32 bits system. I use subversion, and since the last svn up on my 64 bits system, I've got errors : http://pastebin.be/23730 core, wrapper and interface are compilet using the -fPIC option, I do not un...

Error in compiling C++ code?

This is my test.cpp: #include <iostream.h> class C { public: C(); ~C(); }; int main() { C obj; return 0; } When I compile it using the command g++ test.cpp, I get this error message: In file included from /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/backward/iostream.h:31, from test.cpp:1: /usr/lib/gcc...

Does anyone know what the "-FC" option does in gcc g++?

Does anyone know what the "-FC" option does in g++? I have it in my SConstruct script that builds the command line g++ command, I have searched google ...

va_list has not been declared

When compiling some working code on Fedora 11, I am getting this error: /usr/include/c++/4.4.1/cstdarg:56: error: ‘::va_list’ has not been declared I am using: [doriad@davedesktop VTK]$ g++ --version g++ (GCC) 4.4.1 20090725 (Red Hat 4.4.1-2) Does anyone know what the problem could be? Thanks, Dave ...

Makefile Build Directory and dependencies list

Hello, In a makefile, I build all my .o files in a build directory: program: class1.o class2.o class3.o g++ $(BUILDDIR)class1.o $(BUILDDIR)class2.o $(BUILDDIR)class3.o -o $@ It would be cool to generate $(BUILDDIR)class1.o $(BUILDDIR)class2.o $(BUILDDIR)class3.o from the dependencies list... I know that $^ would give me the list...

g++ produce executable for windows

I am using gcc/g++ to compile c/c++ applications - living on OpenSuSe btw. Is there any way (some option i guess) so that g++ will produce an executable suitable for windows ? ...

Escaping in makefile

I'm trying to do this in a makefile and it fails horribly: M_ARCH := $(shell g++ -dumpmachine | awk '{split($1,a,"-");print a[1]}') do you know why? I guess it has to do with escaping, but what and where? ...

Disabling bounds checking for c++ vectors

With stl::vector: vector<int> v(1); v[0]=1; // No bounds checking v.at(0)=1; // Bounds checking Is there a way to disable bounds checking without having to rewrite all at() as []? I am using the GNU Standard C++ Library. Edit: I changed at() to [] in the area where I suspected a bottleneck, and it significantly reduced the computatio...

How do I get missing prototype warnings from g++?

I currently have a project that uses g++ to compile it's code. I'm in the process of cleaning up the code, and I'd like to ensure that all functions have prototypes, to ensure things like const char * are correctly handled. Unfortunately, g++ complains when I try to specify -Wmissing-prototypes: g++ -Wmissing-prototypes -Wall -Werror ...

What is g++'s -pthread equiv in clang?

I'm switching over from g++ to clang however, in g++, I have the -pthread flag, which clang does not seem to recognize. What is the equiv in clang? EDIT: My clang build is pulling from svn on March 5 2010. ...

Problem linking with libpng & zlib

Hi, I'm trying to compile a project that uses both libjpeg and libpng. I know that libpng needs zlib, so I compiled all the three independently and put them (libjpeg.a, libpng.a and libz.a) on a folder called linrel32. What I execude then is: g++ -Llinrel32/ program.cpp otherfile.cpp -o linrel32/executable -Izlib/ -Ilpng140/ -Ijpeg/ -lp...

What is libg2c library?

I have found the code which links against of 'g2c' library. Why do I need it? Just would like to understand why it might be important and what it does in general. Thanks! ...

Avoiding improper std::string initialization with NULL const char* using g++

A there any g++ options which can detect improper initialization of std::string with NULL const char*? I was in the process of turning some int fields into std::string ones, i.e: struct Foo { int id; Foo() : id(0) {} }; ...turned into: struct Foo { std::string id; Foo() : id(0) {} //oooops! }; I completely overlooked...

What does "-Wall" in "g++ -Wall test.cpp -o test" do?

-o changes the output filename (I found that using --help) But I can't find out what -Wall does? ...

Ignore LD_LIBRARY_PATH and stick with library given through -rpath at link time

I'm sitting in an environment which I have no real control over (it's not just me, so basically, I can't change the environment or it won't work for anyone else), the only thing I can affect is how the binary is built. My problem is, the environment specifies an LD_LIBRARY_PATH containing a libstdc++ which is not compatible with the com...

g++: const discards qualifiers

why do I get a discard qualifiers error: customExc.cpp: In member function ‘virtual const char* CustomException::what() const’: customExc.cpp: error: passing ‘const CustomException’ as ‘this’ argument of ‘char customException::code()’ discards qualifiers on the following code example #include <iostream> class CustomException: publi...

When did "and" become an operator in C++

I have some code that looks like: static const std::string and(" AND "); This causes an error in g++ like so: Row.cpp:140: error: expected unqualified-id before '&&' token so after cursing the fool that defined "and" as &&, I added #ifdef and #undef and #endif and now I get Row.cpp:9:8: error: "and" cannot be used as a macro n...