<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Code::Blocks - Microsoft Platform SDK - Error must define target architecture]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe eine Anwendung mit Dev-CPP entwickelt welche das Microsoft Platform SDK benutzt. (Im speziellen die Performance Counter)<br />
Diese Anwendung möchte ich nun von Grund auf neu schreiben und habe beschlossen wxWidgets &amp; Code::Blocks zur Entwicklung zu nehmen. Leider versagt Code::Blocks schon beim folgenden Minimalprogramm...</p>
<p>Kann mir jemand auf die Sprünge helfen wie ich das SDK von Code::Blocks aus nutzen kann? Die Pfadangaben zum Include und den Lib-Verzeichnissen wurden alle eingefügt. Allerdings bringt Code::Blocks immer &quot;#error Must define a target architecture&quot; Auch das ausdokumentierte Macro half nix.</p>
<p>Gibt es irgendwelche gravierenden Unterschiede zwischen den MinGW-Versionen bei Dev-CPP/Code::Blocks?</p>
<pre><code class="language-cpp">//#define _M_IX86
#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;
#include &lt;conio.h&gt;
#include &lt;tchar.h&gt;
#include &lt;pdh.h&gt;
#include &lt;pdhmsg.h&gt;

#define SAMPLE_INTERVAL_MS  1000

int main(int argc, TCHAR **argv)
{

   HQUERY          hQuery;
   HCOUNTER        hCounter;
   PDH_STATUS      pdhStatus;
   PDH_FMT_COUNTERVALUE   fmtValue;
   DWORD           ctrType;
   SYSTEMTIME      stSampleTime;
   PDH_BROWSE_DLG_CONFIG  BrowseDlgData;
   TCHAR            szPathBuffer[PDH_MAX_COUNTER_PATH];

   // Create a query.
   pdhStatus = PdhOpenQuery(NULL, NULL, &amp;hQuery);
   if (ERROR_SUCCESS != pdhStatus)
   {
      _tprintf(TEXT(&quot;PdhOpenQuery failed with %ld.\n&quot;), pdhStatus);
      goto cleanup;
   }

   ZeroMemory(&amp;szPathBuffer, sizeof(szPathBuffer));

   // Initialize the browser dialog window settings.
   ZeroMemory(&amp;BrowseDlgData, sizeof(PDH_BROWSE_DLG_CONFIG));
   BrowseDlgData.bIncludeInstanceIndex = FALSE;   
   BrowseDlgData.bSingleCounterPerAdd = TRUE;
   BrowseDlgData.bSingleCounterPerDialog = TRUE;  
   BrowseDlgData.bLocalCountersOnly = FALSE;      
   BrowseDlgData.bWildCardInstances = TRUE;
   BrowseDlgData.bHideDetailBox = TRUE;
   BrowseDlgData.bInitializePath = FALSE;     
   BrowseDlgData.bDisableMachineSelection = FALSE;
   BrowseDlgData.bIncludeCostlyObjects = FALSE;
   BrowseDlgData.bShowObjectBrowser = FALSE;
   BrowseDlgData.hWndOwner = NULL;   
   BrowseDlgData.szReturnPathBuffer = szPathBuffer;
   BrowseDlgData.cchReturnPathLength = PDH_MAX_COUNTER_PATH;
   BrowseDlgData.pCallBack = NULL;   
   BrowseDlgData.dwCallBackArg = 0;
   BrowseDlgData.CallBackStatus = ERROR_SUCCESS;
   BrowseDlgData.dwDefaultDetailLevel = PERF_DETAIL_WIZARD;
   BrowseDlgData.szDialogBoxCaption = TEXT(&quot;Select a counter to monitor.&quot;);

   // Display the counter browser window. The dialog is configured
   // to return a single selection from the counter list.
   pdhStatus = PdhBrowseCounters (&amp;BrowseDlgData);
   if (ERROR_SUCCESS != pdhStatus)
   {
      if (PDH_DIALOG_CANCELLED != pdhStatus)
      {
         _tprintf(TEXT(&quot;PdhBrowseCounters failed with 0x%x.\n&quot;), pdhStatus);
      }

      goto cleanup;
   }

   // Add the selected counter to the query.
   pdhStatus = PdhAddCounter (hQuery,
                              szPathBuffer, 
                              0, 
                              &amp;hCounter);
   if (ERROR_SUCCESS != pdhStatus)
   {
      _tprintf(TEXT(&quot;PdhBrowseCounters failed with 0x%x.\n&quot;), pdhStatus);
      goto cleanup;
   }

   // Most counters require two sample values to display a formatted value.
   // PDH stores the current sample value and the previously collected
   // sample value. This call retrieves the first value that will be used
   // by PdhGetFormattedCounterValue in the first iteration of the loop
   // Note that this value is lost if the counter does not require two
   // values to compute a displayable value.
   pdhStatus = PdhCollectQueryData (hQuery);
   if (ERROR_SUCCESS != pdhStatus)
   {
      _tprintf(TEXT(&quot;PdhCollectQueryData failed with 0x%x.\n&quot;), pdhStatus);
      goto cleanup;
   }

   // Print counter values until a key is pressed.
   while (!_kbhit()) {

     // Wait one interval.
     Sleep(SAMPLE_INTERVAL_MS);

     // Get the sample time.
     GetLocalTime (&amp;stSampleTime);

     // Get the current data value.
     pdhStatus = PdhCollectQueryData (hQuery);

     // Print the time stamp for the sample.
     _tprintf (
           TEXT(&quot;\n\&quot;%2.2d/%2.2d/%4.4d %2.2d:%2.2d:%2.2d.%3.3d\&quot;&quot;),
               stSampleTime.wMonth, 
               stSampleTime.wDay, 
               stSampleTime.wYear,
               stSampleTime.wHour, 
               stSampleTime.wMinute, 
               stSampleTime.wSecond,
               stSampleTime.wMilliseconds);

     // Compute a displayable value for the counter.
     pdhStatus = PdhGetFormattedCounterValue (hCounter,
                                              PDH_FMT_DOUBLE,
                                              &amp;ctrType,
                                              &amp;fmtValue);

     if (pdhStatus == ERROR_SUCCESS)
     {
         _tprintf (TEXT(&quot;,\&quot;%.20g\&quot;&quot;), fmtValue.doubleValue);
     }
     else
     {
        _tprintf(TEXT(&quot;\nPdhGetFormattedCounterValue failed with 0x%x.\n&quot;), pdhStatus);
        goto cleanup;
     }
   }

cleanup:
   // Close the query.
   if (hQuery)
      PdhCloseQuery (hQuery);

   return pdhStatus;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/226913/code-blocks-microsoft-platform-sdk-error-must-define-target-architecture</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 09:24:30 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/226913.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 07 Nov 2008 15:08:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Code::Blocks - Microsoft Platform SDK - Error must define target architecture on Fri, 07 Nov 2008 15:08:54 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe eine Anwendung mit Dev-CPP entwickelt welche das Microsoft Platform SDK benutzt. (Im speziellen die Performance Counter)<br />
Diese Anwendung möchte ich nun von Grund auf neu schreiben und habe beschlossen wxWidgets &amp; Code::Blocks zur Entwicklung zu nehmen. Leider versagt Code::Blocks schon beim folgenden Minimalprogramm...</p>
<p>Kann mir jemand auf die Sprünge helfen wie ich das SDK von Code::Blocks aus nutzen kann? Die Pfadangaben zum Include und den Lib-Verzeichnissen wurden alle eingefügt. Allerdings bringt Code::Blocks immer &quot;#error Must define a target architecture&quot; Auch das ausdokumentierte Macro half nix.</p>
<p>Gibt es irgendwelche gravierenden Unterschiede zwischen den MinGW-Versionen bei Dev-CPP/Code::Blocks?</p>
<pre><code class="language-cpp">//#define _M_IX86
#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;
#include &lt;conio.h&gt;
#include &lt;tchar.h&gt;
#include &lt;pdh.h&gt;
#include &lt;pdhmsg.h&gt;

#define SAMPLE_INTERVAL_MS  1000

int main(int argc, TCHAR **argv)
{

   HQUERY          hQuery;
   HCOUNTER        hCounter;
   PDH_STATUS      pdhStatus;
   PDH_FMT_COUNTERVALUE   fmtValue;
   DWORD           ctrType;
   SYSTEMTIME      stSampleTime;
   PDH_BROWSE_DLG_CONFIG  BrowseDlgData;
   TCHAR            szPathBuffer[PDH_MAX_COUNTER_PATH];

   // Create a query.
   pdhStatus = PdhOpenQuery(NULL, NULL, &amp;hQuery);
   if (ERROR_SUCCESS != pdhStatus)
   {
      _tprintf(TEXT(&quot;PdhOpenQuery failed with %ld.\n&quot;), pdhStatus);
      goto cleanup;
   }

   ZeroMemory(&amp;szPathBuffer, sizeof(szPathBuffer));

   // Initialize the browser dialog window settings.
   ZeroMemory(&amp;BrowseDlgData, sizeof(PDH_BROWSE_DLG_CONFIG));
   BrowseDlgData.bIncludeInstanceIndex = FALSE;   
   BrowseDlgData.bSingleCounterPerAdd = TRUE;
   BrowseDlgData.bSingleCounterPerDialog = TRUE;  
   BrowseDlgData.bLocalCountersOnly = FALSE;      
   BrowseDlgData.bWildCardInstances = TRUE;
   BrowseDlgData.bHideDetailBox = TRUE;
   BrowseDlgData.bInitializePath = FALSE;     
   BrowseDlgData.bDisableMachineSelection = FALSE;
   BrowseDlgData.bIncludeCostlyObjects = FALSE;
   BrowseDlgData.bShowObjectBrowser = FALSE;
   BrowseDlgData.hWndOwner = NULL;   
   BrowseDlgData.szReturnPathBuffer = szPathBuffer;
   BrowseDlgData.cchReturnPathLength = PDH_MAX_COUNTER_PATH;
   BrowseDlgData.pCallBack = NULL;   
   BrowseDlgData.dwCallBackArg = 0;
   BrowseDlgData.CallBackStatus = ERROR_SUCCESS;
   BrowseDlgData.dwDefaultDetailLevel = PERF_DETAIL_WIZARD;
   BrowseDlgData.szDialogBoxCaption = TEXT(&quot;Select a counter to monitor.&quot;);

   // Display the counter browser window. The dialog is configured
   // to return a single selection from the counter list.
   pdhStatus = PdhBrowseCounters (&amp;BrowseDlgData);
   if (ERROR_SUCCESS != pdhStatus)
   {
      if (PDH_DIALOG_CANCELLED != pdhStatus)
      {
         _tprintf(TEXT(&quot;PdhBrowseCounters failed with 0x%x.\n&quot;), pdhStatus);
      }

      goto cleanup;
   }

   // Add the selected counter to the query.
   pdhStatus = PdhAddCounter (hQuery,
                              szPathBuffer, 
                              0, 
                              &amp;hCounter);
   if (ERROR_SUCCESS != pdhStatus)
   {
      _tprintf(TEXT(&quot;PdhBrowseCounters failed with 0x%x.\n&quot;), pdhStatus);
      goto cleanup;
   }

   // Most counters require two sample values to display a formatted value.
   // PDH stores the current sample value and the previously collected
   // sample value. This call retrieves the first value that will be used
   // by PdhGetFormattedCounterValue in the first iteration of the loop
   // Note that this value is lost if the counter does not require two
   // values to compute a displayable value.
   pdhStatus = PdhCollectQueryData (hQuery);
   if (ERROR_SUCCESS != pdhStatus)
   {
      _tprintf(TEXT(&quot;PdhCollectQueryData failed with 0x%x.\n&quot;), pdhStatus);
      goto cleanup;
   }

   // Print counter values until a key is pressed.
   while (!_kbhit()) {

     // Wait one interval.
     Sleep(SAMPLE_INTERVAL_MS);

     // Get the sample time.
     GetLocalTime (&amp;stSampleTime);

     // Get the current data value.
     pdhStatus = PdhCollectQueryData (hQuery);

     // Print the time stamp for the sample.
     _tprintf (
           TEXT(&quot;\n\&quot;%2.2d/%2.2d/%4.4d %2.2d:%2.2d:%2.2d.%3.3d\&quot;&quot;),
               stSampleTime.wMonth, 
               stSampleTime.wDay, 
               stSampleTime.wYear,
               stSampleTime.wHour, 
               stSampleTime.wMinute, 
               stSampleTime.wSecond,
               stSampleTime.wMilliseconds);

     // Compute a displayable value for the counter.
     pdhStatus = PdhGetFormattedCounterValue (hCounter,
                                              PDH_FMT_DOUBLE,
                                              &amp;ctrType,
                                              &amp;fmtValue);

     if (pdhStatus == ERROR_SUCCESS)
     {
         _tprintf (TEXT(&quot;,\&quot;%.20g\&quot;&quot;), fmtValue.doubleValue);
     }
     else
     {
        _tprintf(TEXT(&quot;\nPdhGetFormattedCounterValue failed with 0x%x.\n&quot;), pdhStatus);
        goto cleanup;
     }
   }

cleanup:
   // Close the query.
   if (hQuery)
      PdhCloseQuery (hQuery);

   return pdhStatus;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1611827</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1611827</guid><dc:creator><![CDATA[sonofsun]]></dc:creator><pubDate>Fri, 07 Nov 2008 15:08:54 GMT</pubDate></item></channel></rss>