I've got a large C project that I'm too far along in to abandon altogether, but I'd like to use some basic cpp functionality. Is it possible to mix these because compilation fails whenever I try to call a cpp function.
the actual call comes from a c source file, but when I compile the project, I get "unresolved external symbol _setVector referenced in function _WndProc@16". I know what this error means, but how would I fix it? compile and link separately?
I'm using visual C++ express 2008.
TIA
Code:
// main.h #ifndef __MYHEADER__ #define __MYHEADER__ // std c includes // defines // cpp prototypes void setVector(const int &, const int &, const unsigned char &); // compiler didn't like this, so changed to void setVector(const int, const int, const unsigned char); #endif
Code:
// vec.cpp
#include <vector>
#include "main.h"
using std::vector;
// declared global vector here
void setVector(const int row, const int col, const unsigned char ch)
{
myvec[row][col] = ch;
}
I'm using visual C++ express 2008.
TIA
Comment