gcc

One MinGW, many GCC versions - how to do it?

Is it possible to have different GCC installations working with one MinGW installation? By MinGW I mean the common base which is always needed regardless which version of GCC compiler we're going to install and use; MinGW runtime binutils make MinGW API for MS-Windows and many other components which are part of MinGW but are not ...

C C++ Linking Error

Hello, all! I am writing a program in C++ which uses the CLAPACK ATLAS library. However, I cannot get the program to link successfully to the library. I have written a small C program to better demonstrate the problem. Interestingly enough, this small demonstration program links just fine if I compile it with GCC, but I get the same link...

What's the best way to isolate "dirty" C code from clean code during compilation?

I have a nice clean standards-compliant codebase that I can compile with GCC's "-ansi -pedantic-errors -Wextra", etc. But now I need to use a source library with associated headers that is decidedly NOT clean code. What's the best way to isolate this code from my own so that I can still compile mine strictly, but can allow leniency wit...

How to detect #includes of nonexistant files in gcc

I am using Xcode's modified gcc, and I notice that sometimes when I include a file that doesn't exist, it just silently skips it. How can I get it to give me a warning? ...

Error When Compiling C++ File In GCC

Hello, I'm using Linux Ubuntu Intrepid Ibex and using as compiler the gcc, but when i try to compile me C++ project file the compiler give me this error: ubuntu@ubuntu-laptop:~/C++$ gcc ClientFile.cpp gcc: error trying to exec 'cc1plus': execvp: No such file or directory What is wrong? Please Help Me!! ...

Build An Linux Executable Using GCC

Hello, I'm using Linux Ubuntu Intrepid Ibex and compiling C++ files with GCC, but when i compile, gcc makes a *.out file, that is the executable, but how i can make Linux executables? Thanks! ...

Error When Reading a Sequencial File In C++

Hello, I'm having some problems when i try to compile my sample C++ project, i'm trying to read a sequencial file, but when i compile i got some errors, here is the code: // ReadClientFile.cpp // Lendo e imprimindo um arquivo sequêncial. #include <iostream> using std::cerr; using std::cout; using std::endl; using std::fixed; using std...

GCC 4.2.1 darwin Avoid duplicate symbols.

I'm building application for iPhone OS 3.0 Due to bug in GCC 4.2.1 I'm adding -all_load flag to linker, to build it on iPhone OS 3.0 But then I get duplicate symbol _fill_fopen_filefunc in /Users/TMC2/Programming/Client/test/build/Debug-iphoneos/test.a(ioapi.o) and /Users/TMC2/Programming/Client/test/build/Debug-iphoneos/test.a(ioapi.o)...

Why does this code only print 42?

Could somebody please explain to me why does this code only print "42" instead of "created\n42"? #include <iostream> #include <string> #include <memory> using namespace std; class MyClass { public: MyClass() {cout<<"created"<<endl;}; int solution() {return 42;} virtual ~MyClass() {}; }; int main(int argc, char *argv[]) { ...

What is a "nearly-empty" class?

...

compiling c++ with gcc/g++ complier

hi im new to c++ and i want to compile my testprogram . i have now 3 files "main.cpp" "parse.cpp" "parse.h" how can i compile it with one command ? ...

How to increase the gcc executable stack size?

I have large Boost/Spirit metaprogram that is blowing gcc's stack when I try to compile it. How can I increase gcc's stack size, so I can compile this program? Note: There's no infinite recursion going on, but there is enough incidental recursion to exhaust gcc's stack. ...

GCC Atomic Builtins instead of pthread?

I've found following article: Use GCC-provided atomic lock operations to replace pthread_mutex_lock functions It refers to GCC Atomic Builtins. What the article suggest, is to use GCC atomic builtins instead of pthread synchronization tools. Is this a good idea? PS. The mysql post is obviously misleading. Atomic Builtins can't replac...

"class std::map used without template paramaters" error

Hi, I'd have to say I'm no expert on using the STL. Here's my problem, I have a class Called LdapClientManager which maintains a number of LDAP clients that are managed by ID. The container holding the LdapClients is declared as a member variable i.e. typedef std::map<int, LdapClient *> LdapClientMap; LdapClientMap _ldapClientMap; T...

Setting GCC 4.2 as the default compiler on Mac OS X Leopard

I'm sure there must be a way to do this. As you are probably aware the latest versions of Xcode (and in fact I think all versions of Xcode) on Leopard come with GCC 4.0.1 and GCC 4.2. GCC 4.0.1 is the default system compiler while GCC 4.2 is an optional compiler you can set in the Xcode project settings. Does anyone know how to set GCC ...

What, if any, are the implications of compiling objects with gcc -fPIC flag if they get used in executables?

I am putting together a makefile for a project i am working on. I have an executable and a shared library in the project. Both use some of the same source files which get compiled separately into object files. To be able to use these objects in the shared library I need to use the -fPIC (position independent code) flag in gcc. Are there ...

Compiler warnings in others' libraries

I link my C++ code against several libraries (a couple of which are heavily header-based), some of which haven't been updated in a while. I've been compiling my code with -Wall and Wextra on GCC 4.0 for a while with no warnings or errors. However, now that I'm using a newer version of GCC (4.3), a number of my files have been printing wa...

ambiguous template wierdness

I have the following code (sorry for the large code chunk, but I could not narrow it down any more) template <bool B> struct enable_if_c { typedef void type; }; template <> struct enable_if_c<false> {}; template <class Cond> struct enable_if : public enable_if_c<Cond::value> {}; template <typename X> struct Base { enum { value ...

C++ GCC4.4 warning: array subscript is above array bounds

I recently upgraded to GCC 4.4 (MinGW TDM build) and now the follow code produces these warning: In member function 'void Console::print(const std::string&)': warning: array subscript is above array bounds Here's the code: void Console::print( const std::string& str ) { std::string newLine( str ); if( newLine.size()...

Difference Betwen Visual C++ 2008 And g++

I'm learning C++ and when I was testing the Microsoft Visual C++ 2008 Express and Eclipse Ganymede, but with the g++ compiler as default, I've noted that a same code in VC++ get some errors and in g++ compile normally, without errors or warnings and execute normally, but I want to know what is the difference between VC++ syntax and g++ s...