NMAKE can't find include file in subfolder

2019-07-29 11:09发布

Using Microsoft's NMAKE with -I option to for include paths. It works for the include files in these folders, but can't seem to find one in a named subfolder:

Here's the resulting command & error message:

cl /nologo /Ox /MD /EHsc /W3 /D_CRT_SECURE_NO_DEPRECATE -I "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\sys"; -I.    "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\sys" "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include" "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include" -DAVOID_WIN32_FILEIO -DCHECK_JPEG_YCBCR_SUBSAMPLING -DDEFAULT_EXTRASAMPLE_AS_ALPHA -DSTRIPCHOP_DEFAULT=TIFF_STRIPCHOP -DSTRIP_SIZE_DEFAULT=8192 -DLOGLUV_SUPPORT -DNEXT_SUPPORT -DTHUNDER_SUPPORT -DLZW_SUPPORT -DPACKBITS_SUPPORT -DCCITT_SUPPORT -DTIF_PLATFORM_CONSOLE -DFILLODER_LSB2MSB  /c tif_unix.c

tif_unix.c
tif_unix.c(35) : fatal error C1083: Cannot open include file: 'sys/types.h': No such file or directory

Two things to note:

  1. The "missing" file, "types.h", IS in the "sys" subfolder of one of the include paths, so "sys/types.h" should have been found, and

  2. The "sys" subfolder was also included (out of desperation) and types.h STILL wasn't found.

Any ideas why this include file can't be found?

1条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-07-29 11:54

It looks like you're not using the option correctly. The syntax is -I directory, and according to the Microsoft documentation, to add more than one directory, you must use this option more than once. If you have faithfully reproduced the actual command-line you're using, then you have got -I directory -I directory directory directory directory, so several of your include directories are ignored.

Assuming you want all of these directories in the include path, the correct syntax is:

-I "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\sys"
-I.
-I "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\sys"
-I "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include"
-I "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include"

Note the use of -I before each directory, including . .

查看更多
登录 后发表回答