c ++ Visual Studio, vc_attributes :: YesNoMaybe: ошибка переопределения типа enum - PullRequest
0 голосов
/ 21 марта 2012

Я пытаюсь получить объем памяти процесса, используя следующий код C ++

#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#include <psapi.h>

void PrintMemoryInfo( DWORD processID )
{
    HANDLE hProcess;
    PROCESS_MEMORY_COUNTERS pmc;

    // Print the process identifier.

    printf( "\nProcess ID: %u\n", processID );

    // Print information about the memory usage of the process.

    hProcess = OpenProcess(  PROCESS_QUERY_INFORMATION |
                             PROCESS_VM_READ,
                             FALSE, 
                             processID );
    if (NULL == hProcess)
        return;

    if ( GetProcessMemoryInfo( hProcess, &pmc, sizeof(pmc)) )
    {
        printf( "\tPageFaultCount: 0x%08X\n", pmc.PageFaultCount );
        printf( "\tYour app's PEAK MEMORY CONSUMPTION: 0x%08X\n", 
                  pmc.PeakWorkingSetSize );
        printf( "\tYour app's CURRENT MEMORY CONSUMPTION: 0x%08X\n", pmc.WorkingSetSize );
        printf( "\tQuotaPeakPagedPoolUsage: 0x%08X\n", 
                  pmc.QuotaPeakPagedPoolUsage );
        printf( "\tQuotaPagedPoolUsage: 0x%08X\n", 
                  pmc.QuotaPagedPoolUsage );
        printf( "\tQuotaPeakNonPagedPoolUsage: 0x%08X\n", 
                  pmc.QuotaPeakNonPagedPoolUsage );
        printf( "\tQuotaNonPagedPoolUsage: 0x%08X\n", 
                  pmc.QuotaNonPagedPoolUsage );
        printf( "\tPagefileUsage: 0x%08X\n", pmc.PagefileUsage ); 
        printf( "\tPeakPagefileUsage: 0x%08X\n", 
                  pmc.PeakPagefileUsage );
    }

    CloseHandle( hProcess );
}

int main( )
{
  PrintMemoryInfo( GetCurrentProcessId() );

    return 0;
}

но есть ошибки типа

Error   2   error C2011: 'vc_attributes::YesNoMaybe' : 'enum' type redefinition 
Error   3   error C2011: 'vc_attributes::AccessType' : 'enum' type redefinition 
Error   4   error C2011: 'vc_attributes::Pre' : 'struct' type redefinition  
Error   5   error C3094: 'repeatable': anonymous usage not allowed  
...

Как решить эту проблему, я использую Visual Studio 2008

1 Ответ

2 голосов
/ 21 марта 2012

Попробуйте очистить и восстановить весь раствор.Есть несколько отчетов с похожей ошибкой, например здесь , с очевидным решением - перестройка.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...