I've run into a problem trying to port a program of mine from C to C++, I am using MSVC++.
Code:
Controller.obj : error LNK2001: unresolved external symbol "private: static struct Color (* PixelBuffer::myPixelBuffer)[512]" (?myPixelBuffer@PixelBuffer@@0PAY0CAA@UColor@@A)
Code:
#ifndef PixelBuffer_h
#define PixelBuffer_h
#include "Types.h"
class PixelBuffer {
private:
PixelBuffer () {}; // Can't create one.
static Color myPixelBuffer[512][512]; // <-- Error here
public:
static void put (int x, int y, Color color) {PixelBuffer::myPixelBuffer[x][y] = color;}
static void display (
void (*initialize) (int width, int depth),
void (*process) (int x, int y, Color color),
void (*finalize) (void))
{
int i, j;
initialize (512, 512);
for (i = 0; i < 512; i++) {
for (j = 0; j < 512; j++) {
process (i, j, myPixelBuffer[i][j]);
}
}
finalize();
return;
}
}; // End class PixelBuffer
#endif
Code:
/*
typedef struct {
int red;
int green;
int blue;
} Color;
*/
struct Color {
int red, green, blue;
};
Now, I'm a little stuck. I don't suppose anyone knows the remedy to this problem?