Garmaine Staff asked 1 year ago

When I use CMake to compile my program. I faced with this error.

framework/base.h:146:30: 错误:expected unqualified-id before ‘&’ token
         catch(std::bad_typeid& e)

my program is posted up as followed:

 void Do()
    {        bool ret = false;
        try
        {
            ret = run();
        }
        catch(std::bad_typeid& e)
        {
            std::cerr << e.what() << '\n';
            errMsg = e.what();
            ret = false;
        }
        catch(...)
        {
            std::cerr << "unknown error" << '\n';
            errMsg = "unknown error";
            ret = false;
        }
    }

CMakeLists.txt:

include_directories(../common)

because this function defines in a Header file. some other modules include this file to use the function do(). So I just write a include_directories() statement in CMakeLists.txt.