Click here to Skip to main content
12,949,601 members (66,004 online)
Rate this:
Please Sign up or sign in to vote.
See more:

I developed an vc++ application where it has a dependent files like 5 .xml files.

It is working fine in my computer where as when i run this .exe in other computer the application is getting struck and not respoding and giving error "unable to find the path" that is unable to access the 5 .xml files.

Should i make any changes in the solution. Any other solution where we can resolve this problem.

Any suggestions would be appreciated.

globally declared xml files are:

const char *faceCascadeFilename = "Haarcascade\\haarcascade_frontalface_alt2.xml";
const char *leftEyeCascadeFilename = "Haarcascade\\haarcascade_mcs_lefteye.xml";
const char *rightEyeCascadeFilename = "Haarcascade\\haarcascade_mcs_righteye.xml"  ;
const char *nose_cascade = "Haarcascade\\haarcascade_mcs_nose.xml";
const char *mouth_cascade = "Haarcascade\\haarcascade_mcs_mouth.xml";
BOOL CDlg::OnInitDialog() 
  EnrollFromCam(CString sString);
  return TRUE;
void EnrollFromCam(CString sString)
faceCascade     = ( CvHaarClassifierCascade *) cvLoad ( faceCascadeFilename,     0, 0, 0 )  ;
leftEyeCascade  = ( CvHaarClassifierCascade *) cvLoad ( leftEyeCascadeFilename,  0, 0, 0 )  ;
rightEyeCascade = ( CvHaarClassifierCascade *) cvLoad ( rightEyeCascadeFilename, 0, 0, 0 )  ;
cascade_nose    = ( CvHaarClassifierCascade *) cvLoad ( nose_cascade,            0, 0, 0 )  ;
cascade_mouth   = ( CvHaarClassifierCascade *) cvLoad ( mouth_cascade,           0, 0, 0 )  ;
if( !(faceCascade || leftEyeCascade ||cascade_nose||cascade_mouth || rightEyeCascade ) )
   MessageBox(NULL, L"ERROR in EnrollFromCam(): Could not load Haar cascade Face detection classifier in "%s".\n", L"Error", 0);

Posted 8-Jan-13 20:26pm
Kumar 091.2K
Updated 8-Jan-13 21:30pm
Jochen Arndt184.9K
jibesh 9-Jan-13 3:31am
what is inside 'cvLoad' i believe this method is loading your xml file. please provide the contents inside 'cvLoad' or please look for FileOpen , OpenFile like APIs in your code.
Kumar 09 9-Jan-13 3:39am
cvload() means, Loads object from file. It provides a simple interface to cvRead. After object is loaded, the file storage is closed and all the temporary buffers are deleted. Thus, to load a dynamic structure, such as sequence, contour or graph, one should pass a valid destination memory storage to the function and assign to the "CvHaarClassifierCascade* faceCascade" variable.
jibesh 9-Jan-13 3:53am
One more item have you set the Path Variable in the other PC as suggested by OpenCV forum?
Kumar 09 9-Jan-13 4:28am
No, should i add the same path which exists in my pc to other pc in the environment variable

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Make sure that you have 5.xml files also copied to the other computer, also check how you get the File Path in your application.

Are you using
to get the File Path?>

Read More about Open CV File Load Error

To be able to execute the application you'll need to modify the PATH environment variable of your system to add the location of OpenCV's DLLs. Add this to end of PATH:

Kumar 09 9-Jan-13 2:45am
no, should i use this function, if yes where should i use and in which class.
jibesh 9-Jan-13 2:50am
i cannot solve your problem without seeing your code, if you can copy the code block where you loading this 5.xml I can tell where you need to put this code. You can use 'Improve Question' widget at the right bottom of your question to modify it.

You must be very clear in asking question because we dont see your computer and we cannot read your mind.
jibesh 9-Jan-13 3:49am
It's the OpenCV methods right. did you maintain the folder structure as same they did in their sample projects?



I am not familiar with Open CV but I believe if you maintain the same folder structure it will work fine.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 5,489
CHill60 3,380
Maciej Los 2,913
Jochen Arndt 1,935
ppolymorphe 1,820

Advertise | Privacy | Mobile
Web02 | 2.8.170524.1 | Last Updated 9 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100