Here is what I have so far. Why syntax error? Am I missing a class def.? I know there are other problems at the bottom, but I want to focus on that stupid syntax error.
#include "stdafx.h"
#include <iostream>
using namespace std;
/* Input Values */
LPCSTR filterName = "MVMCam";
CapInfoStruct m_capInfo;
/* Initialise capInfo here */
/* Output Values */
int index;
HANDLE hDriver;
int nIndex;
int rt=FclInitialize("MVMCam",nIndex,m_capInfo,&hDriver);
if(ResSuccess != rt){
FclUninitialize(&hDriver);
AfxMessageBox("Can not open USB camera!");
return ;
)
If that's your whole code then you're missing a function. C++ is weird like that, you can put declarations and certain definitions outside of a function, but the instant you want to do some work, you need a function. The starting point for a program is called main().
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
/* Input Values */
LPCSTR filterName = "MVMCam";
CapInfoStruct m_capInfo;
/* Initialise capInfo here */
/* Output Values */
int index;
HANDLE hDriver;
int nIndex;
int rt=FclInitialize("MVMCam",nIndex,m_capInfo,&hDriver);
if(ResSuccess != rt){
FclUninitialize(&hDriver);
AfxMessageBox("Can not open USB camera!");
return;
}
}
The error is a tricky one. It's saying that an if statement can't be used outside of a function. That's really reading between the lines and that kind of insight comes from experience working with C/C++. ;) As you write more and more code, you'll get a feel for what's allowed and what's not.