Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/137.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 找不到EnterCriticalSection标识符_C++_Visual Studio 2013_Chromium Embedded - Fatal编程技术网

C++ 找不到EnterCriticalSection标识符

C++ 找不到EnterCriticalSection标识符,c++,visual-studio-2013,chromium-embedded,C++,Visual Studio 2013,Chromium Embedded,好的,我正在编译一个使用。我正在使用64位Windows 7和Visual Studio 2013 RC。正式而言,VS2013 RC不受CEF3支持。但是,我需要VS2013,因为C++11功能仅在VS2013中可用 我下载了CEF3 64位二进制文件,并使用VS2013编译了它们的示例应用程序。它工作得很好(尽管我不得不将头文件添加到一些cef3头文件中) 现在,当我将一些CEF3文件包括到我的项目中时,我得到了一堆编译错误。我正在使用SCON来编译我的项目。当CEF3头文件包含头文件时,看

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

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

现在,当我将一些CEF3文件包括到我的项目中时,我得到了一堆编译错误。我正在使用SCON来编译我的项目。当CEF3头文件包含
头文件时,看起来几乎没有设置/调用某些变量和定义

错误是:

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
cl /Fobuild\gui\GUI.obj /c src\gui\GUI.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 /Fobuild\gui\HtmlGuiComponent.obj /c src\gui\HtmlGuiComponent.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 /Fobuild\models\ModelManager.obj /c src\models\ModelManager.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 /Fobuild\glw\Animation.obj /c src\glw\Animation.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:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(55) : error C2146: syntax error : missing ';' before identifier 'instance'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(55) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(70) : error C2146: syntax error : missing ';' before identifier 'parent_window'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(70) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(71) : error C2146: syntax error : missing ';' before identifier 'menu'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(71) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(86) : error C2146: syntax error : missing ';' before identifier 'window'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(86) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types.h(83) : error C2371: 'char16' : redefinition; different basic types
        C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_string_types.h(51) : see declaration of 'char16'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(65) : error C2146: syntax error : missing ';' before identifier 'm_sec'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(65) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(52) : error C2065: 'm_sec' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(52) : error C2065: 'CRITICAL_SECTION' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(52) : error C2070: 'unknown-type': illegal sizeof operand
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(53) : error C2065: 'm_sec' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(53) : error C3861: 'InitializeCriticalSection': identifier not found
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(56) : error C2065: 'm_sec' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(56) : error C3861: 'DeleteCriticalSection': identifier not found
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(59) : error C2065: 'm_sec' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(59) : error C3861: 'EnterCriticalSection': identifier not found
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(62) : error C2065: 'm_sec' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(62) : error C3861: 'LeaveCriticalSection': identifier not found
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(84) : error C2039: 'instance' : is not a member of '_cef_main_args_t'
        C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(54) : see declaration of '_cef_main_args_t'
        C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(54) : see declaration of '_cef_main_args_t'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(96) : error C2061: syntax error : identifier 'HINSTANCE'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(96) : error C2535: 'CefMainArgs::CefMainArgs(void)' : member function already defined or declared
        C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(93) : see declaration of 'CefMainArgs::CefMainArgs'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(97) : error C2065: 'instance' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(97) : error C2065: 'hInstance' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(120) : error C2039: 'parent_window' : is not a member of '_cef_window_info_t'
        C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(61) : see declaration of '_cef_window_info_t'
        C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(61) : see declaration of '_cef_window_info_t'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(121) : error C2039: 'menu' : is not a member of '_cef_window_info_t'
        C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(61) : see declaration of '_cef_window_info_t'
        C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(61) : see declaration of '_cef_window_info_t'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(122) : error C2039: 'window' : is not a member of '_cef_window_info_t'
        C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(61) : see declaration of '_cef_window_info_t'
        C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(61) : see declaration of '_cef_window_info_t'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(139) : error C2061: syntax error : identifier 'HWND'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(149) : error C2061: syntax error : identifier 'HWND'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(165) : error C2061: syntax error : identifier 'HWND'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(140) : error C2065: 'WS_CHILD' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(140) : error C2065: 'WS_CLIPCHILDREN' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(140) : error C2065: 'WS_CLIPSIBLINGS' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(140) : error C2065: 'WS_TABSTOP' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(141) : error C2065: 'WS_VISIBLE' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(142) : error C2065: 'parent_window' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(142) : error C2065: 'hWndParent' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(143) : error C2065: 'windowRect' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(143) : error C2228: left of '.left' must have class/struct/union
        type is 'unknown-type'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(144) : error C2065: 'windowRect' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(144) : error C2228: left of '.top' must have class/struct/union
        type is 'unknown-type'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(145) : error C2065: 'windowRect' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(145) : error C2228: left of '.right' must have class/struct/union
        type is 'unknown-type'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(145) : error C2228: left of '.left' must have class/struct/union
        type is 'unknown-type'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(146) : error C2065: 'windowRect' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(146) : error C2228: left of '.bottom' must have class/struct/union
        type is 'unknown-type'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(146) : error C2228: left of '.top' must have class/struct/union
        type is 'unknown-type'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(150) : error C2065: 'WS_OVERLAPPEDWINDOW' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(150) : error C2065: 'WS_CLIPCHILDREN' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(150) : error C2065: 'WS_CLIPSIBLINGS' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(151) : error C2065: 'WS_VISIBLE' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(152) : error C2065: 'parent_window' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(152) : error C2065: 'hWndParent' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(153) : error C2065: 'CW_USEDEFAULT' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(154) : error C2065: 'CW_USEDEFAULT' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(155) : error C2065: 'CW_USEDEFAULT' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(156) : error C2065: 'CW_USEDEFAULT' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(158) : error C2065: 'windowName' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(158) : error C2228: left of '.c_str' must have class/struct/union
        type is 'unknown-type'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(158) : error C2228: left of '.length' must have class/struct/union
        type is 'unknown-type'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(158) : error C2660: 'cef_string_utf16_set' : function does not take 3 arguments
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(167) : error C2065: 'parent_window' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(167) : error C2065: 'hWndParent' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_base.h(98) : error C3861: 'InterlockedIncrement': identifier not found
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_base.h(105) : error C3861: 'InterlockedDecrement': identifier not found
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_browser.h(287) : error C2146: syntax error : missing ';' before identifier 'GetWindowHandle'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_browser.h(287) : error C2433: 'CefBrowserHost::HWND' : 'virtual' not permitted on data declarations
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_browser.h(287) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_browser.h(295) : error C2146: syntax error : missing ';' before identifier 'GetOpenerWindowHandle'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_browser.h(295) : error C2433: 'CefBrowserHost::HWND' : 'virtual' not permitted on data declarations
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_browser.h(295) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_browser.h(468) : error C2061: syntax error : identifier 'MSG'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_browser.h(474) : error C2061: syntax error : identifier 'MSG'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_browser.h(287) : error C2253: 'CefBrowserHost::GetWindowHandle' : pure specifier or abstract override specifier only allowed on virtual function
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_browser.h(295) : error C2253: 'CefBrowserHost::GetOpenerWindowHandle' : pure specifier or abstract override specifier only allowed on virtual function
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_keyboard_handler.h(59) : error C2061: syntax error : identifier 'MSG'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_keyboard_handler.h(71) : error C2061: syntax error : identifier 'MSG'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_render_handler.h(129) : error C2061: syntax error : identifier 'HCURSOR'
src\gui\HtmlGuiComponent.cpp(179) : error C2082: redefinition of formal parameter 'clickCount'
scons: building terminated because of errors.
一些突然出现在我面前的错误是:

\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(59) : error C3861: 'EnterCriticalSection': identifier not found
但是应该找到这一点,因为
cef_-win.h
在尝试调用
EnterCriticalSection
之前显然包括

还有许多其他错误似乎不应该发生

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

/* 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;
}
/*示例C/C++,Windows,链接到kernel32.dll*/
#包括
#包括
#包括
静态临界截面cs;/*这是临界截面对象--一旦初始化,
它不能在内存中移动*/
/*如果您使用OOP编程,请将其声明为类中的非静态成员*/
void f()
{
/*进入临界区——其他线程被锁定*/
肠危重科(&cs);
/*做一些线程安全处理*/
/*离开CriticalSection--其他线程现在可以进入CriticalSection()*/
离开关键部门(&cs);
}
int main()
{
/*在进入多线程上下文之前初始化关键部分*/
初始化关键部分(&cs);
f();
/*完成所有操作后释放系统对象——通常在清理代码的末尾*/
删除关键部分(&cs);
返回0;
}

有人知道我为什么会出现这些错误吗?

根据评论:
windows.h
文件不包括在内,因为其他脚本定义的
\u windows\u

试图从一开始就消除错误,因为其中一些可能会在以后产生错误,所以当您修复第一个错误时,您可能会得到不同的第二个、第三个等错误,例如,在cef_types_win.h(55)中是什么?但这就是问题(我认为):第55行或附近没有语法错误……语法错误:缺少“;”在标识符“instance”之前,通常意味着编译器无法解析变量实例的类型,并且假定它是functionRight的名称,它无法解析
HINSTANCE
,这应该在
windows.h
…中定义。对吗?看起来是这样,请检查它前面包含的头,至少有一个头:BaseTsd.h;WinDef.h;另外,您是否使用任何类型的预编译头?