c++

Eclipse’s Ctrl+click does not work and indexer does not seem to update?

I am running Eclipse IDE for C/C++ Developers (Ganymede) and I have recently encountered a problem with it. I can no longer get Ctrl+click navigation to work! I went to my project and tried to rebuild the index, but the rebuild command of the indexer does not work either. I did not do anything to my knowledge that may have caused this...

Is there a C++ dependency index somewhere?

When trying new software and compiling with the classic ./configure, make, make install process, I frequently see something like: error: ____.h: No such file or directory Sometimes, I get really lucky and apt-get install ____ installs the missing piece and all is well. However, that doesn't always happen and I end up googling to fin...

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...

Handle Events Raised by C# COM Object in a Borland C++ Application.

I have spent numerous hours searching and experimenting, but I have not been able to accomplish full interoperability between C# and Borland C++ Builder 6 (notably in handling events in a C++ application that are raised by the C# COM object). I have been able to make calls to a COM object from the C++ application, but I have not been ab...

Seg Fault when using std::string on an embedded Linux platform

Hi, I have been working for a couple of days on a problem with my application running on an embedded Arm Linux platform. Unfortunately the platform precludes me from using any of the usual useful tools for finding the exact issue. When the same code is run on the PC running Linux, I get no such error. In the sample below, I can reliabl...

Declare float or cast float?

Hey I've started to learn c++ using "C++ Primer by Stephen Prate" and I'm currently trying to complete one of the exercises. I am wondering if I should declare arc_to_minute & arc_to_degree as float or cast them as float as I've done already. Any tips welcome! #include <iostream> int main() { using namespace std; cout.setf(ios...

Multi-Threaded MPI Process Suddenly Terminating

Hey all - I'm writing an MPI program (Visual Studio 2k8 + MSMPI) that uses Boost::thread to spawn two threads per MPI process, and have run into a problem I'm having trouble tracking down. When I run the program with: mpiexec -n 2 program.exe, one of the processes suddenly terminates: job aborted: [ranks] message [0] terminated [1] ...

Unable to access tables created with sqlite3 from a program using the C API

I generate an sqlite3 database file (call it db.sl3; invoked interactively as $ sqlite3 db.sl3 from a shell) from within the sqlite3 commandline program, for instance create table people ( id integer, firstname varchar(20), lastname varchar(20), phonenumber char(10) ); ins...

QT 2d list causing segfault

Hi everyone, I've got a program that worked until recently. The offending code is shown here: void writeTimeInfo(fitsfile *fptr, QList<QList<double> > &in) { double data[in.size() * in[0].size()]; long naxes[2]; int status = 0; naxes[1] = in.size(); naxes[0] = in[0].size(); for (int i=0; i<naxes[1]; i++) { for (int j=0; j<n...

How can I find the real size of my C++ class?

I'm working on a homework assignment in which I'm required to use char arrays instead of strings and qsort/bsearch. In my call to bsearch below, I know I'm passing the wrong size of Entry, but I'm not sure how to get the real size, and my compareEntries function is therefore not finding the right objects. Can anyone help me understand ...

Problem to convert string binary (64 bits) to decimal (c++ in iphone)

Hi I have a problem converting a string binary to a decimal I was using bitset bitstring ="1011010001111111"; unsigned long binToDec( string bitstring){ bitset<32> dec (bitstring); return dec.to_ulong(); } All of this works fine, but !! the problem comes when i try to do the same with a bits string with more of 32 bits. I kn...

C++ vs. C++/CLI: Const qualification of virtual function parameters

[All of the following was tested using Visual Studio 2008 SP1] In C++, const qualification of parameter types does not affect the type of a function (8.3.5/3: "Any cv-qualifier modifying a parameter type is deleted") So, for example, in the following class hierarchy, Derived::Foo overrides Base::Foo: struct Base { virtual void Fo...

Cross platform C++ code architecture

I'm having a bit of a go at developing a platform abstraction library for an application I'm writing, and struggling to come up with a neat way of separating my platform independent code from the platform specific code. As I see it there are two basic approaches possible: platform independent classes with platform specific delegates, or...

Creating a C++ program to skip integers in a text file?

This is my first time on this site and I appreciate any help on my problem. I am in my first C++ class and I admit I am not an expert at computer programing, so if you could make your answers as dumbed down an specific as possible it would help out my beginner status immensely. I will be creating a program that decodes encrypted text f...

OpenCV: Reading a file into a CvMat structure

Using OpenCV, saving a CvMat structure into a YAML file on the disk is easy with CvMat* my_matrix = cvCreateMat( row_no, col_no, CV_32FC1 ); cvSave("filename.yml", my_matrix); However, I couldn't find an easy way to read the saved files back from the disk. Is there function in OpenCV that can handle this and create a CvMat structure...

How should I go about generating every possible map<char, char> combination from map<char, vector<char> > ?

I am looking to take a map<char, vector<char> > and generate each possible map<char, char> from it. I understand this may use a sizeable amount of memory and take a bit of time. Each map<char, char> needs to contain every letter a-z, and be mapped to a unique a-z character. ie. ak bj cp dy ev fh ga hb ir jq kn li mx nc oo pz qs rl sd t...

OpenCV Frame Rate Issue

Hi all, I am working on a school project with OpenCV. A major part of the program will be a comparison of histograms. There will be a database of histograms and new histograms will be created from a live video feed then compared to the histograms in the database. Right now I am just trying to get the histograms created correctly from...

Using for_each and boost::bind with a vector of pointers

I have a vector of pointers. I would like to call a function for every element, but that function takes a reference. Is there a simple way to dereference the elements? Example: MyClass::ReferenceFn( Element & e ) { ... } MyClass::PointerFn( Element * e ) { ... } MyClass::Function() { std::vector< Element * > elements; // add...

How to hide specific type completely using typedef?

I have a quick question about encapsulating specific types with typedef. Say I have a class Foo whose constructor takes a certain value, but I want to hide the specific type using typedef: class Foo { public: typedef boost::shared_ptr< std::vector<int> > value_type; Foo(value_type val) : val_(val) {} private: value_type val_; }...

Getting input from a file in C++

Hello everybody, I am currently developing an application, which gets the input from a text file and proceeds accordingly. The concept is the input file will have details in this fomat A AND B B OR C Each and every line will be seperated by a blank space and the input must be taken from the text file and processed by logic....