2
:은 모든 Windows 드라이버 키트 빌드 환경 변수를 선언 할 수 없습니다 내가 지금처럼 사소한 드라이버가
#include <ntddk.h>
NTSTATUS DriverEntry(__in DRIVER_OBJECT* a, __in UNICODE_STRING* b)
{
UNREFERENCED_PARAMETER(a);
UNREFERENCED_PARAMETER(b);
int c; // this fails the build
return 0;
}
비 trival 빌드 출력
C:\Test>pushd %cd%
C:\Test>C:\WinDDK\7600.16385.1\bin\setenv.bat C:\WinDDK\7600.16385.1 fre x64 wnet
WARNING: x64 Native compiling isn't supported. Using cross compilers.
Launching OACR monitor
C:\WinDDK\7600.16385.1>popd
C:\Test>build
BUILD: Compile and Link for AMD64
BUILD: Loading c:\winddk\7600.16385.1\build.dat...
BUILD: Computing Include file dependencies:
BUILD: Start time: Thu Jan 17 10:57:58 2013
BUILD: Examining c:\test directory for files to compile.
BUILD: Saving c:\winddk\7600.16385.1\build.dat...
BUILD: Compiling and Linking c:\test directory
Configuring OACR for 'root:amd64fre' - <OACR on>
_NT_TARGET_VERSION SET TO WS03
Compiling - main.c
1>errors in directory c:\test
1>c:\test\main.c(9) : error C2143: syntax error : missing ';' before 'type'
Linking Executable - objfre_wnet_amd64\amd64\main.sys
1>link : error LNK1181: cannot open input file 'c:\test\objfre_wnet_amd64\amd64\main.obj'
BUILD: Finish time: Thu Jan 17 10:57:58 2013
BUILD: Done
3 files compiled - 1 Error
1 executable built - 1 Error
와 함께 사소한 메이크
TARGETNAME=main
TARGETTYPE=DRIVER
MSC_WARNING_LEVEL=/W4 /WX
SOURCES=main.c
어떻게 지구상에서이 결과가 error C2143: syntax error : missing ';' before 'type'
이 될 수 있습니까?
모든 declerations가 실패하지는 않지만 전역 변수는 선언 할 수 있지만 로컬 변수는 선언 할 수없는 것 같습니다.
네, 그것은이며, OMG,'UNREFERENCED_PARAMETER' 정말 아무것도 확장하지 않고, 컴파일러는 그냥 무시하는 것이라고 생각합니다. 야생 거위 추격전에서 정말로 나를 설정 한 것은 유형이 정의되지 않았거나 누락 된 것 같은 오류였습니다. –
@JohnLeidegren, 'UNREFERENCED_PARAMETER (a)'는'a; '또는'a = a;'(IIRC) 때문에 컴파일러는 아마도 생성 된 바이너리에서이를 생략 할 것이지만 초기 패스를 불평하는 중에 (필자는 생각합니다). – hmjd