第一次用,请教。
try{...........
        .................
...........
}
catch ( CFileException, e ){
AfxMessageBox( "dddddddddddd!");
return FALSE;
}编译出错:
Compiling...
SPCModuleInterface.cpp
D:\face.cpp(165) : warning C4101: 'strTemp1' : unreferenced local variable
D:\face.cpp(164) : warning C4101: 'ntemp1' : unreferenced local variable
D:\face.cpp(252) : error C2143: syntax error : missing ';' before 'try'
D:\face.cpp(252) : error C2143: syntax error : missing ';' before '{'
D:\face.cpp(252) : error C2447: missing function header (old-style formal list?)
D:\face.cpp(258) : error C2143: syntax error : missing ';' before 'catch'
D:\face.cpp(258) : error C2143: syntax error : missing ';' before '{'
D:\face.cpp(258) : error C2447: missing function header (old-style formal list?)

解决方案 »

  1.   

    如果不用try...catch,程序运行正常。
      

  2.   

    CFileException, e 
    逗号去了
      

  3.   

    CFileException, e //去掉逗号
      

  4.   

    catch ( CFileException, e )???CFileException e 是 将捕获的异常放在一个CFileException类型的变量e中,以便用他来做一些异常的处理,比如显示错误信息等,你 加个逗号做甚?
      

  5.   

    我去了“,”
    可还是那个错误。
    用catch (Exception e)
    也出错。++++++
    我是在调用dll文件时捕获他的异常;
    try{
    int face::Create(INPUT * pInput,OUTPUT * pOutput)
    {
    return 
                    
    }
    }
    catch ( _com_error &e ){
    DisplayError(e);
    AfxMessageBox( "dddddddddddd!");
    return FALSE;
    }--------------------Configuration: Server - Win32 Debug--------------------
    Compiling...
    face.cpp
    D:\face.cpp(165) : warning C4101: 'strTemp1' : unreferenced local variable
    D:\face.cpp(164) : warning C4101: 'ntemp1' : unreferenced local variable
    D:\face.cpp(251) : error C2143: syntax error : missing ';' before 'try'
    D:\face.cpp(251) : error C2143: syntax error : missing ';' before '{'
    D:\face.cpp(251) : error C2447: missing function header (old-style formal list?)
    D:\face.cpp(257) : error C2143: syntax error : missing ';' before 'catch'
    D:\face.cpp(257) : error C2143: syntax error : missing ';' before '{'
    D:\face.cpp(257) : error C2447: missing function header (old-style formal list?)
    Error executing cl.exe.
    Creating browse info file...Server.exe - 6 error(s), 2 warning(s)
      

  6.   

    #include <exception> using namespace std;具体了这两条之后才可以使异常处理语句