Ich versuche, Microsoft zu verwenden <winapifamily.h>
und die WINAPI_FAMILY_PARTITION
Makro mich mit einem VS2012 ARM Entwickler Prompt aus dem Visual Studio Tools-Menü zu arbeiten, wenn.. ich benutze die Makros in dem folgenden Code:<winapifamily.h> und „schwerwiegender Fehler C1012: nicht angepasste Klammer: fehlt‚)‘
#if defined(CRYPTOPP_WIN32_AVAILABLE) && defined(WINAPI_FAMILY)
# if !(WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
# undef SOCKETS_AVAILABLE
# endif
#endif
es dann ergibt sich:.
cl.exe /nologo /W4 /D_MBCS /Zi /TP /EHsc /MD /DWINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP /c wait.cpp
wait.cpp
c:\...\config.h(548) : fatal error C1012: unmatched parenthesis : missing ')'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0
\VC\BIN\x86_ARM\cl.exe"' : return code '0x2'
Linie 548 ist #if !(WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
Das Löschen des #if
-Blocks löscht den unmittelbaren Fehler von nicht übereinstimmenden Klammern, führt jedoch an anderen Stellen zu einer Reihe von socketbezogenen Fehlern. Also muss ich in der Lage sein, Windows Store und Windows Phone Apps zu erkennen und die Codepfade zu deaktivieren.
Wo genau ist diese unübertroffene Klammer, und wie repariere ich sie?
Hier sind die relevanten Bits von <winapifamily.h>
. Es kommt aus dem Windows Phone Kit. Ich bin ziemlich sicher, dass ich es wie erwartet benutze.
/*
* Windows APIs can be placed in a partition represented by one of the below bits. The
* WINAPI_FAMILY value determines which partitions are available to the client code.
*/
#define WINAPI_PARTITION_DESKTOP 0x00000001
#define WINAPI_PARTITION_APP 0x00000002
/*
* A family may be defined as the union of multiple families. WINAPI_FAMILY should be set
* to one of these values.
*/
#define WINAPI_FAMILY_APP WINAPI_PARTITION_APP
#define WINAPI_FAMILY_DESKTOP_APP (WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_APP)
/*
* A constant that specifies which code is available to the program's target runtime platform.
* By default we use the 'desktop app' family which places no restrictions on the API surface.
* To restrict the API surface to just the App API surface, define WINAPI_FAMILY to WINAPI_FAMILY_APP.
*/
#ifndef WINAPI_FAMILY
#define WINAPI_FAMILY WINAPI_FAMILY_DESKTOP_APP
#endif
/* Macro to determine if a partition is enabled */
#define WINAPI_FAMILY_PARTITION(Partition) ((WINAPI_FAMILY & Partition) == Partition)
/* Macro to determine if only one partition is enabled from a set */
#define WINAPI_FAMILY_ONE_PARTITION(PartitionSet, Partition) ((WINAPI_FAMILY & PartitionSet) == Partition)
/*
* Macro examples:
* The following examples are typical macro usage for enabling/restricting access to header code based
* on the target runtime platform. The examples assume a correct setting of the WINAPI_FAMILY macro.
*
* App programs:
* Explicitly set WINAPI_FAMILY to WINAPI_PARTITION_APP (cannot access DESKTOP partition)
* Desktop programs:
* Leave WINAPI_FAMILY set to the default above (currently WINAPI_FAMILY_DESKTOP_APP)
*
* Note: Other families and partitions may be added in the future.
*
*
* The WINAPI_FAMILY_PARTITION macro:
* Code-block is available to programs that have access to specified partition.
*
* Example: Available to App and Desktop programs
* #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
*
* Example: Available to Desktop programs
* #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
*
*
* The WINAPI_FAMILY_ONE_PARTITION macro:
* Code-block is available to programs that have access to specified parition, but not others in the partition set.
*
* Example: Available only to App programs
* #if WINAPI_FAMILY_ONE_PARTITION(WINAPI_FAMILY, WINAPI_PARTITION_APP)
*
* Example: Available only to Desktop programs
* #if WINAPI_FAMILY_ONE_PARTITION(WINAPI_FAMILY, WINAPI_PARTITION_DESKTOP)
*
* Example: Available to App, but not Desktop programs
* #if WINAPI_FAMILY_ONE_PARTITION(WINAPI_FAMILY_DESKTOP_APP, WINAPI_PARTITION_APP)
*/
Könnten Sie die ersten Zeilen Ihres Quellcodes (bis zur Zeile/include) schreiben? –
Unwahrscheinlich, das Problem: Es ist als C++ - Code ('/ TP') kompiliert, aber das ist mit C markiert. Versuchen Sie auch, mit '/ w44668' kompilieren (siehe [C4668] (https://msdn.microsoft.com/en -us/library/4dt9kyhy.aspx)/GCC '-Wundef'). Meine Vermutung ist "WINAPI_FAMILY_PARTITION" ist nicht definiert. – cremno
Oh und 'WINAPI_PARTITION_DESKTOP' ist wahrscheinlich auch nicht definiert. Was bedeutet, dass Sie mit '# if! (0 (0))' enden. – cremno