g++

C++ Interface Compiling

EDIT: I figured out the solution. I was not adding -combine to my compile instructions and that was generating the errors. I'm in the process of working through the Deitel and Deitel book C++ How to Program and have hit a problem with building and compiling a C++ interface using g++. The problem is, I've declared the class in the .h...

Non-blocking getch(), ncurses

I'm having some problems getting ncurses' getch() to block. Default operation seems to be non-blocking (or have I missed some initialization)? I would like it to work like getch() in Windows. I have tried various versions of timeout(3000000); nocbreak(); cbreak(); noraw(); etc... (not all at the same time). I would prefer to not (expl...

What does 4: mean in g++ apt-get install version string?

On EasyPeasy 1.1 (for mini notebooks) derived from Ubuntu I installed g++ using apt-get: $ apt-get install g++ One of the lines displayed was: Setting up g++ (4:4.3.1-1ubuntu2) ... What the does "4:" mean? $ g++ --version g++ (Ubuntu 4.3.2-1ubuntu12) 4.3.2 What is the relationship of the "4.3.1" in apt-get to the "4.3.2" g++ ver...

Good URLs for tracking implementation progress of C++0x in MSVC and GCC

Does anyone know good URLs/Sites/mailing lists to track the current implementation progress of C++0x features in MSVC and GCC? BTW: Yes I know there is boost but because I'm also very interested in the new language features I only want to know the progress in MSVC and GCC (as those are the two compilers we use for our projects). ...

Using g++ how can I link with a library that was built using gcc?

I am trying to link a .a library that was built with gcc to a program built using g++. But the name mangling is different. How can I do this? Thanks, CP ...

.h and .H header files in g++

I am using g++ on Ubuntu with a C++ library whose header files all happen to end in .H instead of the traditional .h. I'd rather not modify the include directory ... otherwise I would probably just create symbolic links to .h versions of the headers. I am wondering if there is an easy way to automatically have g++ recognize that .H and...

Standard Template Library using g++

While migrating a program from windows in linux I encountered a problem using the c++ standard template library. I am trying to typedef a template and I am getting the error 'expected initializer before '<' token on this line typedef std::list< std::pair< int,double> > PairList; Any ideas why this would work using mvc++ and not using g...

Templated Barton and Nackman Trick Problems

I'm trying to implement class using the Barton and Nackman trick to avoid dynamic dispatch. (I'm writing MCMC code where performance matters.) I'm not a C++ expert but the basic trick is working for me elsewhere. However I now have a case where the second derived class needs to be templated. This seems to cause problems. The outline ...

g++ searches /lib/../lib/, then /lib/

According to g++ -print-search-dirs my C++ compiler is searching for libraries in many directories, including ... /lib/../lib/: /usr/lib/../lib/: /lib/: /usr/lib/ Naively, /lib/../lib/ would appear to be the same directory as /lib/ lib's parent will have a child named lib, "that man's father's son is my father's son's son" and all ...

Template functor error in g++

I've got some code where I would like to build a vector of elements using the mapped values in a map. The code below works fine in Visual Studio (and seems legit as far as I can tell), but g++ disagrees. template<class PAIR> typename PAIR::second_type foo(const PAIR& arg) { return (arg.second); } class A { private: typedef std...

How can I stop g++ from linking unwanted exception-handling code?

I'm developing an embedded application using GCC/G++ compiled for arm-eabi. Due to resource constraints, I'm trying to disable the standard C++ exception handling. I'm compiling the code with "-fno-exceptions -nostartfiles -ffreestanding". When a global instance of a class exists, and that class contains an instance of another class ...

Exceptions on Linux from a shared object (.so)

I have a test program called ftest. It loads .so files that contain tests and runs the tests that it finds in there. One of these tests loads and runs a .so that contains a Postgres database driver for our O/RM. When the Postgres driver throws an exception which is defined in that .so file (or one that it links to, but ftest does not li...

How to detect whether there is a specific member variable in class?

For creating algorithm template function I need to know whether x or X (and y or Y) in class that is template argument. It may by useful when using my function for MFC CPoint class or GDI+ PointF class or some others. All of them use different x in them. My solution could be reduces to the following code: template<int> struct TT {typed...

GNU C++ error messages

Is there a comprehensive list of error/warning messages for the g++ compiler available online? I'm looking for something similar to the MSDN documentation which describes what each message means and possibly has some sample code which demonstrates the conditions which would cause such an error. I've looked at the GCC online documentati...

VC++ #import directive for GCC/G++

I'm trying to test out a library that provides a VC++ example; however, I use gcc/g++ for all of my projects. Well, the way the VC++ example accesses the library is it uses the #import directive, passing the location of the library DLL, then it does a using namespace LIBRARYNAME, and then it's able to create some undefined type (I'd ass...

Why isn't my new operator called

I wanted to see that a dynamically loaded library (loaded with dlopen etc.) really uses its own new an delete operators and not these ones defined in the calling program. So I wrote the following library.cpp #include <exception> #include <new> #include <cstdlib> #include <cstdio> #include "base.hpp" void* operator new(size_t size) { st...

g++ symbol versioning. Set it to GCC_3.0 using version 4 of g++

Hi all I need to implemente a Java class which uses JNI to control a fiscal printer in XUbuntu 8.10 with sun-java6-jdk installed. The structure is the following: EpsonDriver.java loads libEpson.so libEpson is linked dynamically with EpsonFiscalProtocol.so ( provided by Epson, no source available ) and pthread I use javah to generate...

i386mingw32-g++ not created :(

I have installed MinGW cross compiler in Linux , but i'm not able to create i386mingw32msvc-g++ because of which i'm not able to cross compile my cpp application.what has to be done to create it. in /usr/local/cross-tools/bin i've all these executables i386-mingw32-addr2line, i386-mingw32-ar, i386-mingw32-as, i386-mingw32-gcc, i386-mingw...

ios::nocreate error while compiling a C++ code

While, compiling a package, written in C++ on RHEL 5.0. I am getting the following error. > error: nocreate is not a member of std::ios The source-code corresponds to: ifstream tempStr(argv[4],ios::in|ios::nocreate); I have tried #g++ -O -Wno-deprecated <file.cpp> -o <file> as well as: #g++ -O -o <file> Please sugg...

C-library not linking using gcc/g++

I have a c-library which I use in gcc. The library has the extension .lib but is always linked as a static library. If i write a program which uses the library as c-code, everything as a-ok. If I however rename the file to .cpp (doing simple stuff that works in both c/c++) I get undefined reference. These are simple small programs I writ...