c++

force visual studio to link all symbols in a lib file

Is there any way to force visual studio to link all symbols from a lib file into the dll as atm it is optimizing "unused" functions which are needed by the program using the dll at run time. I tried using the /OPT:NOREF and /OPT:NOICF but they dont seem to work. The reason i need them is because they are global class which register th...

Windows API "Chess Timer" Sepmaphore Event

Is there a semaphone that works like a Chess timer, meaning; Thread A completes its task, loops back up to the top and calls the Semaphore This triggers Thread 2 which proceeds through its code, loops back up to the top and calls the Semaphore This triggers Thread A which... So the Semaphore is both blocking and signaling. I know I ...

How do you translate this code from Processing to C++ ?

Hi, I wrote this code in Processing (www.processing.org) and was wondering how would one implement it using C++? int i = 0; void setup() { size(1000,1000); } void draw() { // frameRate(120); PImage slice = get(); set(0,20,slice); if( i % 2 == 0 ) fill(128); else fill(0); i++; rect(0,0,width,20); } As you can see this...

Windows speech c++

Hy my name is Joey and i would like to know if there is a way to use speech in C++ if so can someone point me to references and books deeply appreciated... ...

wxWidgets and VC++

I decided to familiarize myself with wxWidgets today. I downloaded version 2.8.9 (current release), and compiled the library in all the desired modes. I am able to build/run the samples that ship with wxWidgets out of the box. However, when I compile with /Za (i.e., language extensions disabled), I get over 100 build errors on even the ...

Problems Registering XPCOM component

Hi, I'm working on my first XPCOM component. Unfortunately, I can't register it successfully. Building is ok. Here's the makefile CXX = g++ CPPFLAGS += -fno-rtti \ -fexceptions \ -shared \ -fshort-wchar # Change this to point at your Gecko SDK directory. GECKO_SDK_PATH = /path/to/gecko/sdk # GCC onl...

Is there a way to split one texture into an array of them using SOIL in C++?

I'm using SOIL in my project, and I need to take in a single texture, and than convert it into an array of textures using different parts of the first texture. (To use a sprite sheet). I'm using SDL and OpenGL by the way. ...

Proper stack and heap usage in C++?

I've been programming for a while but It's been mostly Java and C#. I've never actually had to manage memory on my own. I recently began programming in C++ and I'm a little confused as to when I should store things on the stack and when to store them on the heap. My understanding is that variables which are accessed very frequently shou...

How to get system time in C++?

In fact i am trying to calculate the time a function takes to complete in my program. So i am using the logic to get system time when i call the function and time when the function returns a value then by subtracting the values i get time it took to complete. So if anyone can tell me some better approach or just how to get system time at...

Linker errors with private members of class in header file

Hi. I'm trying to build a project in Visual Studio 2008. I'm getting a bunch of linker errors that are really bothering me. My application is a Win32 console application using only native ANSI C++. They are all linker errors of the same pattern. Linker errors are related to every single private static data member of classes I have defin...

Which is the best book to learn visual C++ ?

I've learned the essentials of C++ and would like to learn Visual C++ (VC++) I want to be master in native , MFC and .NET for Windows programming. I already bought a book on VC++ by Ivor Horton. But the language seems hard to understand. Does anyone have any better book recommendations? ...

static member variable of a subclassed class

Is it OK to have a static member variable defined in a base class, and having several derived classes each using its own instance of this member variable? The following code compiles successfully, and prints the right output, but I am still not sure that doing something like that is a good practice. In the following example, how can it ...

Statically initializing a structure with arrays of varying length

I've got a static map of identifier<=>struct pairs, and each struct should contain some arrays. Everything is known at compile time. That is, I want to have something like this here: ID1 => name: someString flagCount: 3 flags: [1, 5, 10] statically created (if possible). Of course, a declaration like: struct Info { ...

doubt about a function definition (three dots in parameters..)

Hi, i came across a function definition: char* abc(char *f, ...) { } i am finding it hard to know how this code is working... what do the three dots mean?? Thanks. ...

How to find what objects a given CLSID supports

Question: Based on a CLSID, how can I find out what objects (or interfaces) it supports for IClassFactory::CreateInstance Note: Currently using CLSIDFromProgID to obtain CLSID ...

Is There A Built-In Way to Split Strings In C++?

well is there? by string i mean std::string ...

C++ FILE readInt function? (from a binary file)

Is there a function for FILE (fopen?) that allows me to just read one int from a binary file? So far I'm trying this, but I'm getting some kind of error I can't see cause the program just crashes without telling me. void opentest() { FILE *fp = fopen("dqmapt.mp", "r"); int i = 0; int j = 0; int k = 0; int * buffer; ...

istringstream "get" method implementation

The "method" implementation says istringstream get int get(); Extracts a character from the stream and returns its value (casted to an integer). I wanted to see its implementation. Edit:Removed the part which I am trying to port ...

C++ "smart" predicate for stl algorithm.

I need to designe predicate for stl algorithms such as find_if, count_if. namespace lib { struct Finder { Finder( const std::string& name ): name_( name ) { } template< typename TElement > bool operator( const TElement& element ) { return element.isPresent(...

Creating/Opening Events in C++ and checking if they are fired

I have two threads that use an event for synchronization. In each thread they use the same call: ::CreateEvent( NULL,TRUE,FALSE,tcEventName ) The producer thread is the one that makes the call first, while the consumer thread makes the call last, so it's technically opening, not creating the event... I assume. But, when SetEvent is c...