c++

Error Using PDCurses: Cannot Open File Libc.lib

I'm getting the error: 1>LINK : fatal error LNK1104: cannot open file 'LIBC.lib' Here's my source code: #include <curses.h> int main() { initscr(); /* Start curses mode */ printw("Hello World !!!"); /* Print Hello World */ refresh(); /* Print it on to the real screen */ getch(); ...

How to know if an enumerator has reached the end of the collection in C#?

Hello, I am porting a library from C++ to C#. The old library uses vectors from C++ and in the C# I am using generic Dictionaries because they're actually a good data structure for what I'm doing (each element has an ID, then I just use using TypeDictionary = Dictionary<String, Type>;). Now, in the C# code I use a loop like this one Typ...

Does the usage of interfaces slow down programs?

Possible Duplicate: What is the performance cost of having a virtual method in a C++ class? Is it true that interfaces slow down programs? I have heard that this is the case because during running time each during each usage of an object implementing this interface the decision has to be made which class implementing the inter...

How to get decimal value of a unicode character in c++

For one of my opensource project, i need to compute decimal equivalent of given unicode character. For example if tamil character L'அ' given, output should be 2949 . I am using c++ in Qt environment. I googled and couldnot find a solution for this. Pls help if you know a solution for this. ...

how to place struct in union

Hello, I have an union X. It's size is 64bits. How can I write (if possible) its declaration if I want to access those 64 bits as: 1. 4 int16_t: p,q,r,s; 2. Array of 4 int16_t: a[4] 3. 2 int32_t: n, m; 4. Array of 2 int32_t: b[2] 5. 1 int64_t z; ...

Guidelines for writing flexible software?

I've been developing an interpreter in C++ for my (esoteric, if you want) programming language some time now. One of the main things that I have noticed: I start with a flexible concept, and the further I code (Tokenizer->Parser->Interpreter) the less flexible the whole system gets. For example: I didn't implement an include function at...

C++ shared objects

Hello, I have got four classes A, B, C and D. Class A has a member b of class B. Class B has a member c of class C. A has a member D* dpointer; This hierarchy has to be preserved (in fact this is a GUI with app, window, panel as A, B and C). Now B and C must use a method from *dpointer. Is there something more elegant than givin...

C++: how to declare template array as function parameter

Very similar to this post How can I declare template array as a parameter in templated function? Something like this code: template <unsigned i> void my_func (char (&a)[i]); //yes, I do need that reference ...

c# Wrapper to native c++ code, wrapping a parameter which is a pointer to an array

Hi, I have the following simple DLL in c++ un-managed code; extern "C" __declspec(dllexport) void ArrayMultiplier(float (*pointerArray)[3], int scalar, int length); void ArrayMultiplier(float (*pointerArray)[3], int scalar, int length) { for (int i = 0 ; i < length ; length++) { for (int j = 0; j < 3; j++) { ...

Figuring out what makes a C++ class abstract in VS2008

I'm using VS2008 to build a plain old C++ program (not C++/CLI). I have an abstract base class and a non-abstract derived class, and building this: Base* obj; obj = new Derived(); fails with the error "'Derived': cannot instantiate abstract class". (It may be worth noting, however, that if I hover over Base with the cursor, VS will po...

How to load/save C++ class instance (using STL containers) to disk

I have a C++ class representing a hierarchically organised data tree which is very large (~Gb, basically as large as I can get away with in memory). It uses an STL list to store information at each node plus iterators to other nodes. Each node has only one parent, but 0-10 children. Abstracted, it looks something like: struct node { pub...

Virtual methods as Comp function to sort

Hello everyone! I'm new to C++ and i'm trying to use std::sort function to sort a vector of Solutions. The code is something like this (solution list is a *vector): void SolutionSet::sort(Comparator &comparator) { std::sort(solutionsList_->begin(), solutionsList_->end(), &comparator::compare); } The comparator param is a Comparat...

number of months between two dates - using boost's date

I've used boost::gregorian::date a bit now. I can see that there are the related months & years & weeks duration types. I can see how to use known durations to advance a given date. Qu: But how can I get the difference between two dates in months (or years or weeks) ? I was hoping to find a function like: template<typename DURATION> ...

does passing __m128i objects by reference to inline function cause these objects to be moved to stack?

Hello, I'm writing transpose function for 8x16bit vectors with SSE2 intrinsics. Since there are 8 arguments for that function (a matrix of 8x8x16bit size), I can't do anything but pass them by reference. Will that be optimized by the compiler (I mean, will these __m128i objects be passed in registers instead of stack)? Code snippet: i...

Start and run a class member function in background, in QT/C++

Once a minute I want to run a task, not blocking other GUI functions. I heared somthing about QConcurent::run ... Or should I use signals and slots? ...

Using TinyXML ( linking libraries ? in c++ )

+Hi... i am a newbie ... and i don't know how to include external libraries in c++. This is sooo hard. I want to use TinyXML. so i made this : example2.cpp #include <iostream> #include "tinyxml.h" void write_app_settings_doc( ) { TiXmlDocument doc; TiXmlElement* msg; TiXmlDeclaration* decl = new TiXmlDeclaration( "...

C++ class is not being included properly.

Hello all, I have a problem which is either something I have completely failed to understand, or very strange. It's probably the first one, but I have spent the whole afternoon googling with no success, so here goes... I have a class called Schedule, which has as a member a vector of Room. However, when I compile using cmake, or even b...

Problem with reading file line-by-line

I'm trying to complete an exercise to write a program that takes the following command line arguments: an input file, an output file, and an unspecified number of words. The program is to read the contents of the input file line by line, find for each word given which lines contain the word, and print the lines with their line number to ...

How can I decode the boost library naming?

I tried to find out that gd means in boost library name and I only found two other people looking for the same thing. I suppose it should be a place where this is clearly documented and I would like to find it. mt - multitheaded, get it with bjam threading=multi s - bjam runtime-link=static g - using debug versions of the standard and...

C++ Pointer Objects vs. Non Pointer Objects

Possible Duplicate: Why would you ever want to allocate memory on the heap rather than the stack? Test2 *t2 = new Test2(); t2->test(); Test2 t3; t3.test(); Why would I want to create a pointer object of type Test2? Why not just do non pointer version of Test2? Why would I want to do pointer objects? Found answer here: Wh...