I am having issues getting this piece of code to compile. I am compiling with Eclipse on OS X 10.6. The problem seems to occur only when using vectors. I cannot seem to use the push_back function at all. Every time I try, I get the error "expected constructor, destructor, or type conversion before '.' token". Here are a few snippets of m...
I am building an app that will do some object tracking from a video camera feed and use information from that to run a particle system in opengl. The code to process the video feed is somewhat slow 200 - 300 milliseconds per frame right now. The system that this will be running on has a dual core processor. To maximize performance I am...
Hi!
I'm working on a program, which should list all files and it's size(for now...). I created a simple application, which should write the data to a listbox. I'm trying to write the data in two columns(the first should be the name, and next to it, in an other column, it's size), but i can't figure out, how should i do this.
Can someone...
I'm working on improving my skills in other languages, coming from using c++ as my primary programming language. My current project is hammering down C#.net, as I have heard it is a good in-between language for one who knows both c++ and VB.net.
Typically when working with an unknown number of elements in c++ I would declare my variable...
While reading various C and C++ sources, I have encountered two macros __APPLE__ and __OSX__. I found plenty of use of __OSX__ in various codes, especially those originating from *BSD systems.
However, sometimes I find that testing __OSX__ only is not sufficient and I have to complete tests with __APPLE__ macro.
The Porting Command Li...
Possible Duplicate:
Why does GetErrorMessage return wrong password, when the user name is wrong?
Since GetErrorMessage gave the same string for invalid password and username, I decided to use GetLastError(), as it has a separate error for each.
However with the incorrect username it still gives me the code 12014? (password ...
I'm creating a console application in which I'd like to record key presses (like the UP ARROW). I've created a Low Level Keyboard Hook that is supposed to capture all Key Presses in any thread and invoke my callback function, but it isn't working. The program stalls for a bit when I hit a key, but never invokes the callback. I've checked...
Hi, I'm trying to make a Stack using an underlying linked list structure.
Maybe I'm wrong, but I'm having trouble with the remove() function.
int Stack::remove(){
node* victim = new node;
int popped;
popped = top->element;
victim = top;
top = victim->next;
delete victim;
return popped;
}
I'm getting glibc ...
Hi there ,
Why isn't openGL object-orientied? Everybody teaches Object Orientated Programming + Design Patterns, but OpenGL has many global functions. Isn't this bad style?
...
Hey all, so I am trying to build a simple binary tree that has two keys and evaluates the sum for its sorting. Here is what it's looking like:
struct SumNode
{
int keyA;
int keyB;
SumNode *left;
SumNode *right;
};
class SumBTree
{
public:
SumBTree();
~SumBTree();
void insert(int, int);
...
I have following code:
#include <iostream>
using namespace std;
class Base
{
private:
int i;
char ch;
public:
void showdata()
{
cout<<"Int:"<<i<<endl;
cout<<"Char:"<<ch<<endl;
}
//int pub_data ;
} ;
int main()
{
Base ob;
ob.showdata() ;
//cout<<"Public Data:"<<ob.pub_data<<endl;
...
I am trying to build a 2 dimensional array in C++ while I don't know how many rows I will have. Here is some code:
In the header file:
class model
{
... ...
float vertices[][3];
... ...
}
And in the .cpp file:
istringstream iss(str);
for (int i = 0; i <=2; i++)
{
iss >> vertices[counter][i];
...
In Python whenever I had a bunch of functions that I wanted to use across multiple programs I'd make another .py file and then just import that wherever I needed it. How would I do that in C/C++? Do I dump both prototype and implementation into an .h file? or do I need to place the function prototypes in the .h file and the implementatio...
Hi, I have an old C++ project I made a while back. Well, it is a CPU emulator. Whenever a CPU fault happens(such as divide by zero, or debug breakpoint interrupt, etc) in my code it just does a throw and in my main loop I have something like this:
try{
*(uint32_t*)&op_cache=ReadDword(cCS,eip);
(this->*Opcodes[op_cache[0]])();
...
void WriteChar(char c)
{
INPUT input = {0};
input.type = INPUT_KEYBOARD;
input.ki.wVk= VkKeyScanEx(c, GetKeyboardLayout(0) ) ;
SendInput(1,&input, sizeof(INPUT));
}
VkKeyScanEx returns different key codes for '/' and '?'(same key), however if you try using this method to write a message containing '?', it will only w...
Hello,
I wanted to know how fast is a single-inheritance virtual function call when compared to one same boost::function call. Are they almost the same in performance or is boost::function slower?
I'm aware that performance may vary from case to case, but, as a general rule, which is faster, and to a how large degree is that so?
Thank...
EDIT: SOLVED
I'm working on a multi-threaded project right now where I have a base worker class, with varying worker classes that inherit from it. At runtime, the worker classes become threads, which then perform work as needed.
Now, I have a Director I've written which is supposed to maintain an array of pointers to all of the workers...
hi all,
i use CImg for my image processing work. I had written a small piece of code which is follows:
#include "../CImg.h"
#include <iostream>
using namespace std;
using namespace cimg_library;
int main(int argc,char**argv)
{
CImg<int> img(argv[1]);
CImgDisplay disp;
disp.assign(img);
while(!disp.is_closed)
disp.wait();
ret...
http://www.adp-gmbh.ch/cpp/templates/static_members.html makes it clear what I need to do - if the template has a single parameter.
What if it had two?
template <typename T, typename T2> class X {
public:
static int st_;
};
How would I template the static memebr data?
template <typename T, typename T2> int, int X<T, T2...
Attention please:
I already implemented this stuff, just not in any way generic or elegant. This question is motivated by my wanting to learn more tricks with the stl, not the problem itself.
This I think is clear in the way I stated that I already solved the problem, but many people have answered in their best intentions with solution...