I think the app should have one more argument -- an output filename of the file that will contain trained HOG detector. I saw you wrote CvSVM in a file above. But the idea is that the output -- trained detector -- has to be in the format of HOGDescriptor to be used in other applications. I think train_svm() may return trained detector as vector< float > & hog_detector, then you can save it in the following way: HOGDescriptor::setSVMDetector(hog_detector) and  HOGDescriptor::save(..).