c++

compile error when I use C++ inheritance

Hi, I am new to this website and I am trying a simple inheritance example in C++. I checked my code lots of times and I really see nothing wrong with it, however the compilers gives me errors: my code: #ifndef READWORDS_H #define READWORDS_H using namespace std; #include "ReadWords.h" /** * ReadPunctWords inherits ReadWords, so MUST...

Using legacy resource dll's in C#

I'm using a legacy, unmanaged, resource only c++ dll in a new c# app. I've managed to load resources from the dll using hardcoded resource numbers. Is there any way to do this using the resource id's in C#? The old C++ code is still being maintained, which means the resource ids/values may change. This may make the resource number...

Installing poco library

im trying to install the poco library for visual c++ 2008 but when I type this command buildwin.cmd 90 I get the following error "'devenv' is not recognized as an internal or external command, operable program or batch file." The readme file says there is an alternate way to install poco from visual studio itself but i don't quite k...

Why can't I forward-declare a class in a namespace like this?

class Namespace::Class; Why do I have to do this?: namespace Namespace { class Class; } Using VC++ 8.0, the compiler issues: error C2653: 'Namespace' : is not a class or namespace name I assume that the problem here is that the compiler cannot tell whether Namespace is a class or a namespace? But why does this matter sinc...

setting File Version automatically after compile

Is there any tool which can inject into an .exe or .dll information like File Version, Product name, Copyright, etc? I did find a tool called StampVer but it can only modify resources that are already in the file itself. I could use it but would need to modify a bunch of Visual Studio projects to include some dummy information, and I w...

Pointer to a class and function - problem

Firstly I'll show you few classes. class A { public: B * something; void callSomething(void) { something->call(); } }; class B { public: A * activeParent; B(A * parent) { activeParent = parent; } void call(void) { activeParent->something = new C; } }; class C : public B { publ...

Image format and unsigned char arrays

I'm developping imaging functions (yes I REALLY want to reinvent the wheel for various reasons). I'm copying bitmaps into unsigned char arrays but I'm having some problem with byte size versus image pixel format. for example a lot of images come as 24 bits per pixel for RGB representation so that's rather easy, every pixel has 3 unsign...

C++ specialized template inherit from non-specialized version

I was trying to solve a problem, but found a different solution. however out of curiosity like to know if the following is possible: template< class > struct S; template< > struct S< Foo > : struct< Foo > {}; I would like to be able to inherit nonspecialized struct from specialized struct.the example above does not work because the in...

Are there any automated unit testing frameworks for testing an in-house threading framework?

We have created a common threading framework to manage how we want to use threads in our applications. Are there any frameworks out there like gtest or cppunit that solely focus on unit testing threads, thread pools, thread queues, and such? Right now I just kind of manually go through some steps that I know I should cover and do check...

[C++] Using Structs -- Odd Issue

Been awhile since I've used structs in C++. Any idea why this isn't working? My compiler is complaining about DataStruct not being a recognized type but Intellisense in VC++ is still able to see the data members inside the struct so the syntax is ok... Frustating. xD struct DataStruct { int first; }; int main(int argc, char **...

What is the best way to wait for a variable in a multithreaded application

I would like to do something like the below for a multi-threaded program: // wait for variable to become true but don't hog resources // then re-sync queues Is something like this a good solution? while (!ready) { Thread.Sleep(250); // pause for 1/4 second; }; ...

Is there a better way to load a dll in C++?

Right now I do something like this and it seems messy if I end having a lot of functions I want to reference in my DLL. Is there a better and cleaner way of accessing the functions without having to create a typedef for each function definition so that it will compile and load the function properly. I mean the function definitions are al...

Is it possible to write a varargs function that sends it argument list to another varargs function?

Possible Duplicate: C Programming: Forward variable argument list. What I'd like to do is send data to a logging library (that I can't modfify) in a printf kind of way. So I'd like a function something like this: void log_DEBUG(const char* fmt, ...) { char buff[SOME_PROPER_LENGTH]; sprintf(buff, fmt, <varargs>); log...

Boost.MPL and type list generation

Background This is for a memory manager in a game engine. I have a freelist implemented, and would like to have a compile-time list if these. (A MPL or Fusion vector, for example). The freelist's correspond to allocation sizes, and when allocating/deallocating objects of size less than a constant, they will go to the corresponding freel...

C++ object class problems when used in another class

Having trouble when trying to create a class using another class(and 2 inner classes), I think it might be a syntax problem. The first class class listitem { //listitem.h(11) public: //MONSTER CLASS static class monster { public: monster(string thename); monster(void); ~monster(void); privat...

difference between foo[i] and foo->at(i) with stl vector

is there any reason why foo = (bar->at(x))->at(y); works but foo = bar[x][y]; does not work, where bar is a vector of vectors (using the c++ stl) the declaration is: std::vector< std::vector < Object * > * > ...

Easiest way to download HTML page from web?

I have a web page whose content I'd like to download into a wxString. For example, let's say that page is this: http://www.example.com/mypage.html And wxString would contain HTML source. In some other languages, say PHP for example, I would write something like this: $html = file_get_contents('http://www.example.com/mypage.html'); ...

Byte swap of a byte array into a long long.

Hi, I have a program where i simply copy a byte array into a long long array. There are a total of 20 bytes and so I just needed a long long of 3. The reason I copied the bytes into a long long was to make it portable on 64bit systems. I just need to now byte swap before I populate that array such that the values that go into it go r...

Where should I be using a static library in C++

What are the use cases of using static libraries in C++? I have seen that people create DLLs instead or some that use static libraries only. Whats your recommendation? ...

Reload option values in boost::program_options from new source

I'm just starting to dig into boost::program_options for the first time. I like it quite a bit. However, what I'm trying to accomplish with it doesn't seem to be something its designers have accounted for. I want to use boost::program_options to parse both command line options as well as config files. So far so good. Additionally, t...