找不到输入关键部分标识符

EnterCriticalSection identifier not found

本文关键字:标识符 键部 输入 找不到      更新时间:2023-10-16

好的,我正在编译一个使用 Chromium Embedded Framework 3 的项目。 我正在使用Windows 7 64位和Visual Studio 2013 RC。 CEF3 不支持 VS2013 RC。 但是,我需要VS2013,因为C++11功能仅在VS2013中可用。

我下载了CEF3 64位二进制文件,并使用VS2013编译了它们的示例应用程序。 它工作得很好(尽管我不得不将<algorithm>头文件添加到一些 cef3 头文件中)。

现在,当我将一些 CEF3 文件包含在我的项目中时,我遇到了一堆编译错误。 我正在使用SCons来编译我的项目。 当 CEF3 头文件包含<windows.h>头文件时,看起来几乎可以设置/调用某些变量和定义......

错误是:

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
cl /FobuildguiGUI.obj /c srcguiGUI.cpp /TP /w /wd4350 /EHsc /MD /DDEBUG /DPACKAGE_VERSION="0.0.1" /DPACKAGE_BUGREPORT="https://github.com/jarrettchisholm/glr/issues" /DBOOST_SPIRIT_USE_PHOENIX_V3
cl /FobuildguiHtmlGuiComponent.obj /c srcguiHtmlGuiComponent.cpp /TP /w /wd4350 /EHsc /MD /DDEBUG /DPACKAGE_VERSION="0.0.1" /DPACKAGE_BUGREPORT="https://github.com/jarrettchisholm/glr/issues" /DBOOST_SPIRIT_USE_PHOENIX_V3
GUI.cpp
HtmlGuiComponent.cpp
cl /FobuildmodelsModelManager.obj /c srcmodelsModelManager.cpp /TP /w /wd4350 /EHsc /MD /DDEBUG /DPACKAGE_VERSION="0.0.1" /DPACKAGE_BUGREPORT="https://github.com/jarrettchisholm/glr/issues" /DBOOST_SPIRIT_USE_PHOENIX_V3
ModelManager.cpp
cl /FobuildglwAnimation.obj /c srcglwAnimation.cpp /TP /w /wd4350 /EHsc /MD /DDEBUG /DPACKAGE_VERSION="0.0.1" /DPACKAGE_BUGREPORT="https://github.com/jarrettchisholm/glr/issues" /DBOOST_SPIRIT_USE_PHOENIX_V3
Animation.cpp
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_types_win.h(55) : error C2146: syntax error : missing ';' before identifier 'instance'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_types_win.h(55) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_types_win.h(70) : error C2146: syntax error : missing ';' before identifier 'parent_window'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_types_win.h(70) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_types_win.h(71) : error C2146: syntax error : missing ';' before identifier 'menu'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_types_win.h(71) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_types_win.h(86) : error C2146: syntax error : missing ';' before identifier 'window'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_types_win.h(86) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_types.h(83) : error C2371: 'char16' : redefinition; different basic types
        C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_string_types.h(51) : see declaration of 'char16'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(65) : error C2146: syntax error : missing ';' before identifier 'm_sec'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(65) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(52) : error C2065: 'm_sec' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(52) : error C2065: 'CRITICAL_SECTION' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(52) : error C2070: 'unknown-type': illegal sizeof operand
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(53) : error C2065: 'm_sec' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(53) : error C3861: 'InitializeCriticalSection': identifier not found
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(56) : error C2065: 'm_sec' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(56) : error C3861: 'DeleteCriticalSection': identifier not found
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(59) : error C2065: 'm_sec' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(59) : error C3861: 'EnterCriticalSection': identifier not found
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(62) : error C2065: 'm_sec' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(62) : error C3861: 'LeaveCriticalSection': identifier not found
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(84) : error C2039: 'instance' : is not a member of '_cef_main_args_t'
        C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_types_win.h(54) : see declaration of '_cef_main_args_t'
        C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_types_win.h(54) : see declaration of '_cef_main_args_t'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(96) : error C2061: syntax error : identifier 'HINSTANCE'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(96) : error C2535: 'CefMainArgs::CefMainArgs(void)' : member function already defined or declared
        C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(93) : see declaration of 'CefMainArgs::CefMainArgs'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(97) : error C2065: 'instance' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(97) : error C2065: 'hInstance' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(120) : error C2039: 'parent_window' : is not a member of '_cef_window_info_t'
        C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_types_win.h(61) : see declaration of '_cef_window_info_t'
        C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_types_win.h(61) : see declaration of '_cef_window_info_t'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(121) : error C2039: 'menu' : is not a member of '_cef_window_info_t'
        C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_types_win.h(61) : see declaration of '_cef_window_info_t'
        C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_types_win.h(61) : see declaration of '_cef_window_info_t'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(122) : error C2039: 'window' : is not a member of '_cef_window_info_t'
        C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_types_win.h(61) : see declaration of '_cef_window_info_t'
        C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_types_win.h(61) : see declaration of '_cef_window_info_t'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(139) : error C2061: syntax error : identifier 'HWND'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(149) : error C2061: syntax error : identifier 'HWND'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(165) : error C2061: syntax error : identifier 'HWND'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(140) : error C2065: 'WS_CHILD' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(140) : error C2065: 'WS_CLIPCHILDREN' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(140) : error C2065: 'WS_CLIPSIBLINGS' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(140) : error C2065: 'WS_TABSTOP' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(141) : error C2065: 'WS_VISIBLE' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(142) : error C2065: 'parent_window' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(142) : error C2065: 'hWndParent' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(143) : error C2065: 'windowRect' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(143) : error C2228: left of '.left' must have class/struct/union
        type is 'unknown-type'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(144) : error C2065: 'windowRect' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(144) : error C2228: left of '.top' must have class/struct/union
        type is 'unknown-type'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(145) : error C2065: 'windowRect' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(145) : error C2228: left of '.right' must have class/struct/union
        type is 'unknown-type'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(145) : error C2228: left of '.left' must have class/struct/union
        type is 'unknown-type'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(146) : error C2065: 'windowRect' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(146) : error C2228: left of '.bottom' must have class/struct/union
        type is 'unknown-type'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(146) : error C2228: left of '.top' must have class/struct/union
        type is 'unknown-type'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(150) : error C2065: 'WS_OVERLAPPEDWINDOW' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(150) : error C2065: 'WS_CLIPCHILDREN' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(150) : error C2065: 'WS_CLIPSIBLINGS' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(151) : error C2065: 'WS_VISIBLE' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(152) : error C2065: 'parent_window' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(152) : error C2065: 'hWndParent' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(153) : error C2065: 'CW_USEDEFAULT' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(154) : error C2065: 'CW_USEDEFAULT' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(155) : error C2065: 'CW_USEDEFAULT' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(156) : error C2065: 'CW_USEDEFAULT' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(158) : error C2065: 'windowName' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(158) : error C2228: left of '.c_str' must have class/struct/union
        type is 'unknown-type'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(158) : error C2228: left of '.length' must have class/struct/union
        type is 'unknown-type'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(158) : error C2660: 'cef_string_utf16_set' : function does not take 3 arguments
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(167) : error C2065: 'parent_window' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/internal/cef_win.h(167) : error C2065: 'hWndParent' : undeclared identifier
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/cef_base.h(98) : error C3861: 'InterlockedIncrement': identifier not found
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/cef_base.h(105) : error C3861: 'InterlockedDecrement': identifier not found
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/cef_browser.h(287) : error C2146: syntax error : missing ';' before identifier 'GetWindowHandle'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/cef_browser.h(287) : error C2433: 'CefBrowserHost::HWND' : 'virtual' not permitted on data declarations
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/cef_browser.h(287) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/cef_browser.h(295) : error C2146: syntax error : missing ';' before identifier 'GetOpenerWindowHandle'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/cef_browser.h(295) : error C2433: 'CefBrowserHost::HWND' : 'virtual' not permitted on data declarations
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/cef_browser.h(295) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/cef_browser.h(468) : error C2061: syntax error : identifier 'MSG'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/cef_browser.h(474) : error C2061: syntax error : identifier 'MSG'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/cef_browser.h(287) : error C2253: 'CefBrowserHost::GetWindowHandle' : pure specifier or abstract override specifier only allowed on virtual function
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/cef_browser.h(295) : error C2253: 'CefBrowserHost::GetOpenerWindowHandle' : pure specifier or abstract override specifier only allowed on virtual function
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/cef_keyboard_handler.h(59) : error C2061: syntax error : identifier 'MSG'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/cef_keyboard_handler.h(71) : error C2061: syntax error : identifier 'MSG'
C:UsersJarrettprojectscef_binary_3.1547.1412_windows64include/cef_render_handler.h(129) : error C2061: syntax error : identifier 'HCURSOR'
srcguiHtmlGuiComponent.cpp(179) : error C2082: redefinition of formal parameter 'clickCount'
scons: building terminated because of errors.

我突然出现的一些错误是:

cef_binary_3.1547.1412_windows64include/internal/cef_win.h(59) : error C3861: 'EnterCriticalSection': identifier not found

但是应该找到这一点,因为cef_win.h在尝试调用EnterCriticalSection之前清楚地包括<windows.h>

还有其他各种错误似乎不应该发生。

我创建了一个简单的小示例文件,其中包含我的项目使用的相同 CEF3 头文件,并使用 SCons 编译,它编译得很好。 示例应用如下所示:

/* Sample C/C++, Windows, link to kernel32.dll */
#include <cef_app.h>
#include <cef_client.h>
#include <cef_render_handler.h>

static CRITICAL_SECTION cs; /* This is the critical section object -- once initialized,
                               it cannot be moved in memory */
                            /* If you program in OOP, declare this as a non-static member in your class */ 
void f()
{
    /* Enter the critical section -- other threads are locked out */
    EnterCriticalSection(&cs);
    /* Do some thread-safe processing! */
    /* Leave the critical section -- other threads can now EnterCriticalSection() */
    LeaveCriticalSection(&cs);
}
int main()
{
    /* Initialize the critical section before entering multi-threaded context. */
    InitializeCriticalSection(&cs);
    f(); 
    /* Release system object when all finished -- usually at the end of the cleanup code */
    DeleteCriticalSection(&cs);
    return 0;
}

任何人都知道为什么我会收到这些错误?

根据

注释:不包括windows.h文件,因为其他脚本定义_WINDOWS_