C++ “greater”: 未声明的标识符错误

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/u014035615/article/details/79733751

本人Visual Studio2015,在使用C++ STL中的set,multiset时

定义multiset <int,std::greater<int>> m 报错

C++ “greater”: 未声明的标识符错误

解决方案:在头文件中加入#include<functional>即可解决

展开阅读全文

未声明标识符 的问题.

06-23

这是个DLL 挂钩rnrn// KeybdHook.cpp : 定义 DLL 的初始化例程。rn//rn#pragma data_seg(".SHARDAT")rnstatic HWND ghWndMain = 0;rnstatic HHOK ghKeyHook = NULL;rn#pragma data_seg()rn HINSTANCE ghInstance = 0;rn HOOKPROC glpfnHookProc = 0;rnrn#include "stdafx.h"rn#include "KeybdHook.h"rn#include ".\keybdhook.h"rnrn#ifdef _DEBUGrn#define new DEBUG_NEWrn#endifrnrnLRESULT EXPORTED_DLL_FUNCTION KbdHookProc (int nCode, WPARAM wParam, LPARAM lParam)rnrn BOOL bHandledKeystroke = FALSE;rnrn if(((DWORD)lParam & 0x40000000) && (HC_ACTION == nCode))rn rn switch (wParam)rn rn case VK_F10:rn AfxMessageBox("捕获F10");rn bHandledKeystroke = TRUE;rn break;rnrn default:rn break;rn rn rnrn return (bHandledKeystroke?TRUE:CallNextHookEx (ghKeyHook, nCode, wParam ,lParam));rnrnrnBOOL EXPORTED_DLL_FUNCTION InstallKeyboardHook (HWND hWnd)rnrn BOOL bSuccess = FALSE;rn if(!ghKeyHook)rn rn ghWndMain = hWnd;rn glpfnHookProc = (HOOKPROC)KbdHookProc;rnrn bSuccess = (NULL != (ghKeyHook = SetWindowsHookEx (WH_KEYBOARD, glpfnHookProc, ghInstance, NULL)));rn rnrn return bSuccess;rnrnrnBOOL EXPORTED_DLL_FUNCTION DeInstallKeyboardHook (HWND hWnd)rnrn if(ghKeyHook)rn rn if(TRUE == (0 != UnhookWindowsHookEx(ghKeyHook)))rn rn ghKeyHook = NULL;rn rn rnrn return ( NULL == ghKeyHook);rnrnrnc:\Documents and Settings\dyt\My Documents\Visual Studio Projects\KeybdHook\KeybdHook.cpp(36) : error C2065: “ghKeyHook” : 未声明的标识符rnc:\Documents and Settings\dyt\My Documents\Visual Studio Projects\KeybdHook\KeybdHook.cpp(42) : error C3861: “ghKeyHook”: 即使使用参数相关的查找,也未找到标识符rnc:\Documents and Settings\dyt\My Documents\Visual Studio Projects\KeybdHook\KeybdHook.cpp(44) : error C2065: “ghWndMain” : 未声明的标识符rnc:\Documents and Settings\dyt\My Documents\Visual Studio Projects\KeybdHook\KeybdHook.cpp(45) : error C2065: “glpfnHookProc” : 未声明的标识符rnc:\Documents and Settings\dyt\My Documents\Visual Studio Projects\KeybdHook\KeybdHook.cpp(47) : error C2065: “ghInstance” : 未声明的标识符rnrn我在顶头定义了,为什么说未声名 论坛

没有更多推荐了,返回首页