c++

Compiling using gcc 3.2.3 on RHE 5.3

Some work I'm doing for a client requires me to build using a very old version of gcc on Red Hat Enterprise. We recently shifted from 4.x to 5.3 and I'm hitting some compile errors when I try to build simple example: #include <iostream> int main() { std::cout << "Hello World" << std::endl; return 0; } I get the following: b...

For graphics drawing on WinCE platform, which language is faster: MFC VC++ or C#

Hi, I need to draw extensive realtime graphics on WinCE platform. For that purpose, which language is better between VC++ and C# to get high performance? Moreover, the graphics application that we would be developing should be linked to currently existing c++ modules. If writing intermediate layer involves lot of effort if we choose c#, ...

Help with camera in OpenGL

Right now my application rotates on camera.rotationX, Y Z and does a -translation of camera.x,y,z on the modelview matrix. How could I equivocate this to a call to gluLookAt? Thanks basically how could I get this: glMatrixMode(GL_MODELVIEW); glLoadIdentity(); //starts here glRotatef(Camera.rotx,1,0,0); glRotatef(...

How to find undefined virtual functions of a classes.

I am porting a game from windows to mac. Here I am stuck with a bunch of linker errors. All errors similar to Undefined symbols "typeinfo for Baseclass", referenced from: typeinfo for Subclass Subclass.oor "vtable for Aclass referenced from _ZTVNAclass:` I know that the problem because of missing definition for virtual fun...

C++ animated cursor

Hi everybody, I'm using this code to invoke animated cursor in C++ builder: void __fastcall TcfListatArtikujtLst::FormActivate(TObject *Sender) { ActiveControl = cxGrid1; Application->ProcessMessages(); const int cnCursorID1 = 1; Screen->Cursors[cnCursorID1] = LoadCursorFromFile("cursors\\hourglas.ani"); Cursor = cnCurs...

Accessing array beyond the limit

Hi All, I have two character array of size 100 (char array1[100], char array2[100]). Now i just want to check whether anybody is accessing array beyond the limit or not. Its necessary because suppose allocated memory for array1 and array2 are consecutive means as the array1 finish then array2 starts. Now if anyone write: array1[101], co...

Pointer (trick) interesting question. Memory Reference

update, this question was based on this code http://jeffreystedfast.blogspot.com/2010/01/weird-bugs-due-to-gcc-44-and-strict.html One trick question about C pointer. Read code snippet below and try explain why the list value changed ? tail has the memory address of list. how is possible list be changed below ? typedef struct _node ...

How to convert from BYTE* to QString?

I have a DATA_BLOB structure but I need to convert it to QString. How can I do this? ...

Coding progress bar advice

In my application i am parsing an xml file and validating the contents with xsd schema. When xml file gets bigger it takes some time to parse file and validate the contents. In this case I want visualize parsing and validation phases with progress bar. How to do this? Note: I am using Qt with C++ ...

undefined reference when using extern

I have the following setup (hopefully this is not too bare an example): A.h typedef std::map<unsigned int, float> MyClass; extern MyClass inst; A.cpp MyClass inst; B.h #include <A.h> void foo(); B.cpp #include <B.h> void foo { inst.myClassFunc(); } Now, when I use inst in B.cpp I get undefined reference to inst. Any id...

Boost Asio problems, Server-Client, Slow on a real network?

I have created a client-server architecture using Boost Asio. The entire thing works, I can send and receive messages, etc, so there is no question about the correctness. However, when I implement it in a real network, all of a sudden it becomes VERY slow. When I run the server and client on the same computer itgoes blazingly fast, but ...

What is the byte alignment of the elements in a std::vector<char> ?

I'm hoping that the elements are 1 byte aligned and similarly that a std::vector<int> is 4 byte aligned ( or whatever size int happens to be on a particular platform ). Does anyone know how standard library containers get aligned? ...

About pipe behavior in windows

hPipe = CreateNamedPipe( lpszPipename, // pipe name PIPE_ACCESS_DUPLEX, // read/write access PIPE_TYPE_MESSAGE | // message type pipe PIPE_READMODE_MESSAGE | // message-read mode PIPE_WAIT, // blocking mode PIPE_UNLIMITED_INSTAN...

IXSLTemplate::putref_stylesheet returns E_INVALIDARG

Well, it's been several hours I'm lost... IXSLTemplate::putref_stylesheet doesn't document any error except E_FAIL. However in my case putref_stylesheet returns E_INVALIDARG. GetErrorInfo() is only redundant telling me that the "Argument is invalid". So I am not left with much information. However my code is pretty close to all exampl...

Identifying keywords of a (programming) language

Hi all, this is a follow up to my recent question ( Code for identifying programming language in a text file ). I'm really thankful for all the answers I got, it helped me very much. My code for this task is complete and it works fairly well - quick and reasonably accurate. The method i used is the following: i have a "learning" perl s...

Error while mapping shared library sections: libhmmm.so: Success.

I'm having trouble with gdb and loading debugging information from shared libraries. The error I get when running from within gdb is: >>run Error while mapping shared library sections: libhmmm.so: Success. .... .... >>break container_main Error cannot access memory at 0x9f18 The shared library in question exists and is located in the...

C++ boost date format

Hi, I have a vector string of dates in the from "dd-mmm-yyyy" so for example todays date would be: std::string today("07-Sep-2010"); I'd like to use the date class in boost but to create a date object the constructor for date needs to be called as follows: date test(2010,Sep,07); Is there any easy/elegant way of passing da...

C++ : Implement the copy-assignment operator in a class with *all* const data members. Does this make sense?

Hello, long-time reader, first-time poster here, with a (hopefully) straightforward question about C++ class design. Imagine I have a class used to represent some trivial numerical data, like a vector. I want this class to be immutable in terms of its members, but still support correct copy-assignment behaviour. This is what the shell ...

In what scenarios crash happens before control comes to main() function ?

Possible Duplicate: Is there any way a C/C++ program can crash before main()? Hi, In what scenarios, application crashes before control reaches main() function ? My understanding so far: Global and Global static initialization happen before main(). So if order of initialization is not proper then it could lead crash when using...

efficient longest common subsequence algorithm library?

I'm looking for a (space) efficient implementation of an LCS algorithm for use in a C++ program. Inputs are two random access sequences of integers. I'm currently using the dynamic programming approach from the wikipedia page about LCS. However, that has O(mn) behaviour in memory and time and dies on me with out of memory errors for larg...