C ++ TlHelp32.h不工作? [英] C++ TlHelp32.h not working?

查看:184
本文介绍了C ++ TlHelp32.h不工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


错误:标识符CreateToolhelp32Snapshot是标识符CreateToolhelp32Snapshot undefined


尝试使用CreateToolhelp32Snapshot时。当我使用VS中的peek definition功能时,我发现在这个头文件中有错误,在某些区域它说:



任何想法如何解决这个问题?

  #includestdafx.h
#include< TlHelp32.h>
#include< Windows.h>
#include< iostream>

使用namespace std;

类函数{
$ b $ public:
void playerHealthPrinter(){
HANDLE hProcess;
DWORD dwPID,dwProtection,dwCaveAddress;

BOOL bPOn,bIOn,bProt;
HANDLE hPID = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,NULL);


解决方案 > < windows.h> 。以下内容应该有效:

  #include< Windows.h> 
#include< TlHelp32.h> //< - include * after * windows.h

如果它仍然不起作用,请发布 MCVE ,其中包含VS的相关标题和版本。


I've included the TlHelp32.h header properly though I keep getting the message:

"Error: identifier "CreateToolhelp32Snapshot" is undefined"

when attempting to use CreateToolhelp32Snapshot. When I used the "peek definition" feature in VS I found that there are errors within this header where in certain areas it says:

"Error expected a ';'"

Any ideas how to fix this?

#include "stdafx.h"
#include <TlHelp32.h> 
#include <Windows.h>
#include <iostream>

using namespace std;

class Functions{

public:
    void playerHealthPrinter(){
        HANDLE hProcess;
        DWORD dwPID, dwProtection, dwCaveAddress;

        BOOL bPOn, bIOn, bProt;
        HANDLE hPID = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);

解决方案

Never include Win32 headers before <windows.h>. The following should work, instead:

#include <Windows.h>
#include <TlHelp32.h> // <-- include *after* windows.h

If it still doesn't work then please post an MCVE including the relevant headers and version of VS.

这篇关于C ++ TlHelp32.h不工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆