2017-05-28 53 views
-2

問題與this相同,但是,該解決方案對我無效。`DebugActiveProcessStop'未申報(首次使用此功能)

根據DebugActiveProcessStop函數文檔,支持的最小客戶端是Windows XP。我正在使用Windows 7.

// #ifdef _WIN32_WINNT 
// #undef _WIN32_WINNT 
// #endif 

#define NTDDI_VERSION 0x05010000 
// #define _WIN32_WINNT 0x0502 

#include <iostream> 
#include <windows.h> 

using namespace std; 

class CppDBG 
{ 
    ... 
    public: 
     BOOL detach (void); 
     ... 
}; 

... 

BOOL CppDBG :: detach (void) 
{ 
    if (DebugActiveProcessStop(pid)) { 
     cout << "[+] Finished debugging. Exiting..."; 
     return true; 
    } 
    else { 
     cout << "[-] Error" << endl; 
     return false; 
    } 
} 

int main() 
{ 
    CppDBG dbg; 
    ... 
    dbg.detach(); 
    return 0; 
} 
+1

'我正在使用Windows 7' - 那又怎樣?絕對不管你在哪個系統上編譯你的代碼。只有你使用哪個* sdk *版本纔是重要的(並且完全可以使用)。如果您使用* sdk * - 只需搜索「DebugActiveProcessStop」聲明的位置,是否在條件塊(*#if *)中,並且符合此條件 – RbMm

回答

0

我猜你的IDE有一箇舊版本的Windows API安裝。

你得到的錯誤是一個編譯器錯誤,告訴你編譯器不知道DebugActiveProcessStop是什麼。對於編譯器來說,這可以是任何東西(例如變量,常量等)。此錯誤與系統運行的Windows版本無關。

要解決此問題,請嘗試從Microsoft下載Windows SDK,並告訴您的編譯器使用它(更改包含目錄,庫路徑等)。這很大程度上取決於您使用的IDE。但互聯網應該提供足夠的幫助。

+0

如果您的編譯器是MinGW,那麼很可能您正在使用一個古老的MinGW,沒有任何在Windows 2000之後引入的API。改爲使用MinGW-w64;這是不斷更新。 – andlabs

相關問題