c++

Facing following error while .so build on eclipse CDT c++ --- Please suggest

not able to upload img .. please check at following site... http://i40.tinypic.com/ilzyqa.gif ...

Lua and C++: separation of duties

Please help to classify ways of organizing C++/Lua game code and to separate their duties. What are the most convenient ways, which one do you use? For example, Lua can be used for initializing C++ objects only or at every game loop iteration. It can be used for game logic only or for graphics, too. Some game engines provide full contro...

Member variable pointers to COM objects

Hi Folks, Is there any problem with keeping member variable pointer refernces to COM objects and reussing the reference through out the class in C++. Is anybody aware of a reason why you would want to call .CreateInstance every time you wanted a to use the COM object i.e. you were getting a fresh instance each time. I cannot see any re...

In ADL_Display_ConnectedDisplays_Get() from ATI's ADL Library, the out parameter lpConnections is confusing me

The API defined in the ADL SDK manual reads: int ADL_Display_ConnectedDisplays_Get(int iAdapterIndex, int* lpConnections) They say that lpConnections is the pointer to the bit field indicating whether the output connectors on the specified adapter have devices physically attached to them. This information is exactly what I want but no...

How close can I get C# to the performance of C++ for small intensive tasks?

I was thinking about the speed difference of C++ to C# being mostly about C# compiling to byte-code that is taken in by the JIT compiler (is that correct?) and all the checks C# does. I notice that it is possible to turn a lot of these functions off, both in the compile options, and possibly through using the unsafe keyword as unsafe co...

C++ setTimout function ?

What's the cheapest way for a JavaScript like setTimeout-function in C++? I would need this: 5000 miliseconds from now, start function xy (no parameters, no return value). The reason for this is I need to initialize COM for text to speech, but when I do it on dll attach, it crashes. It works fine however if I do not call CoInitialize...

Loading a dll from a dll ?

What's the best way for loading a dll from a dll ? My problem is I can't load a dll on process_attach, and I cannot load the dll from the main program, because I don't control the main program source. And therefore I cannot call a non-dllmain function, too. ...

bad file descriptor with close() socket (c++)

hi everybody! I'm running out of file descriptors when my program can't connect another host. The close() system call doesn't work, the number of open sockets increases. I can se it with cat /proc/sys/fs/file-nr Print from console: connect: No route to host close: Bad file descriptor connect: No route to host c...

Semaphores in unmanaged code

I've been using the Semaphore class to create semaphores. However, the examples use managed code (requires /clr), and I need to use unmanaged code because it seems FreeType doesn't like working with managed code. How can I create two simple threads which use a semaphore in unmanaged code? ...

Thread Local Memory, Using std::string's internal buffer for c-style Scratch Memory.

I am using Protocol Buffers and OpensSSL to generate, HMACs and then CBC encrypt the two fields to obfuscate the session cookies -- similar Kerberos tokens. Protocol Buffers' API communicates with std::strings and has a buffer caching mechanism; I exploit the caching mechanism, for successive calls in the the same thread, by placing it...

How to communicate between service controller and a service/daemon?

It is easy to display the status of a Windows service or to control it (start/stop) from a GUI application but the question if how about receiving/sending notifications from the service? Like: service telling to the user monitoring it that it needs attention. Please consider that you can have several controllers started at any time in a...

How to create pointer-to-mutable-member?

Consider the following code: struct Foo { mutable int m; template<int Foo::* member> void change_member() const { this->*member = 12; // Error: you cannot assign to a variable that is const } void g() const { change_member<&Foo::m>(); } }; Compiler generates an error message. The thing is that th...

Several ifstream vs. ifstream + constant seeking

I'm writing an external merge sort. It works like that: read k chunks from big file, sort them in memory, perform k-way merge, done. So I need to sequentially read from different portions of the file during the k-way merge phase. What's the best way to do that: several ifstreams or one ifstream and seeking? Also, is there a library for e...

Does anyone know of a simple yet flexible 2d scene graph in c++?

I'm searching a simple 2d scene graph written in c++, possibly on top of OpenGL but that's not mandatory: the perfect thing would be the Cocos2d/Cocos2d-iphone scenegraph in c++. Do you know of any existing implementations? ...

Problem with blocking unix domain sockets

I'm writing an application that is split into two parts for Mac OS X - a daemon and an agent. I'm using a standard unix socket to communicate between the daemon and the agents. That is, the socket is created with PF_UNIX and SOCK_STREAM. When agents are created (whenever a user logs in), one of the first things it does is to connect to...

Getting error while linking with g++

Hi all, I try to compile and link my application in 2 steps : Compiling: g++ -c -o file1.o file1.cc general_header.h g++ -c -o file2.o file2.cc general_header.h g++ -c -o file3.o file3.cc general_header.h Linking: g++ -o myApp file1.o file2.o file3.o I'm getting a link error as following: file1.o: file not recog...

ANSI C++: Diferences between delete and delete[]

I was looking a snipset of code: int* ip; ip = new int[100]; delete ip; The example above states that: "This code will work with many compilers, but it should instead read:" int* ip; ip = new int[100]; delete [] ip; Is this indeed the case? I use the compiler "Microsoft (R) 32-bit C/C++ Optimizing Compiler V...

How to change QPushButton icon using stylesheets in Qt app

Is it possible to set and change the icon on a QPushButton using stylesheets? I need this for a Windows-based white-label Qt4.5 application that customers stylize using stylesheets. Thanks. ...

How to identify Draft from Inbox and Sent mails In ALL MAIl mailbox

Hello, I am working on a mail client Application for downloading gmail emails, which uses IMAP C-client library. I want to download emails from "ALLMAIL" mailbox folder. as you know ALLMAIL folder consists of Inbox,Sent Mail and Draft Mails. Here my requirement is to distinguish Draft from Inbox and Sent mails. Usually if we downlo...

Variable not accessible within an if statment

I have a variable which holds a score for a game. My variable is accessible and correct outside of an if statement but not inside as shown below score is declared at the top of the main.cpp and calculated in the display function which also contains the code below cout << score << endl; //works if(!justFinished){ cout << sc...