I'm doing a face recognition project for my engineer's degree, using c++ api. I think that everything regarding face recognition in c++ is fairly straightforward, even simpler than in C (less pointers). To use PCA you have a class named PCA described here. Just use the proper methods and read documentation with understanding. To build the matrix with input data I've created a matrix of proper size, then pasted pictures as rows (use method reshape) into it (there is a method in cv::Mat that lets you to get easily a row of a matrix). You just need to keep sure that base data and tested data have the same parameters (channels, size,etc.)
EDIT:
using namespace cv; //somewhere near top
inserting data to data matrix:
62 Mat reshaped=img.reshape(1,1);
63 Mat dataRow=_data.row(y++);
64 resize(reshaped,dataRow,dataRow.size(),0,0,CV_INTER_LINEAR);
computing pca:
251 _pca(_data,Mat(),CV_PCA_DATA_AS_ROW); //compute pca
252 _pca.project(_data,_vectors); // project original data to new coordinates
As opencv's documentation isn't the best out there, it doesn't hurt to spend some time reading it. Most of the c api functions have their equivalents in c++ api, You only need to do some "write into search window and hit enter" searching. And, there are also tutorials in c++ to get a grip of the c++ api.