36342

NMAKE can't find include file in subfolder

Question:

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:

<ol><li>

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

</li> <li>

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

</li> </ol>

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

Answer1:

It looks like you're not using the option correctly. The syntax is -I directory, and according to the Microsoft documentation, <a href="http://msdn.microsoft.com/en-us/library/73f9s62w%28v=vs.80%29.aspx" rel="nofollow">to add more than one directory, you must use this option more than once</a>. 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 <em>each</em> directory, <em>including</em> . .

Recommend

  • Compiling CUDA program
  • VC++ exception handling - app crashes anyway
  • Why would /Qvec-report:2 return nothing ? (MSVC 2012)
  • How can you examine lib files?
  • VC++ missing type specifier - int assumed. Note: C++ does not support default-int [duplicate]
  • Can you put a pimpl-Class inside a vector
  • Alignment and the STL in VS 2012/VC11
  • how can I solve transcendental equation?
  • Don't understand errors on HelloWorld in VS when included std_lib from Stroustrup's book [
  • Outlook 365 add-in only appears in Outlook 2013 client
  • double precision error when converting to scientific notation
  • SOCKS in C/C++ or another language?
  • python & Mysql: unsupported operand type(s) for -: 'int' and 'tuple'
  • How can I determine if process is 32 or 64Bit from a handle?
  • How to unwind to the first view controller on a navigation stack
  • What is the Linux Equivalent of Kernel32.dll?
  • not able to create VC++ project, with VS11
  • How to format code on aptana 3?
  • Visual studio 2015 keystroke with mouse button
  • How to create a custom Powershell operator?
  • Upgrade project from WorkLight 6.1 to MobileFirst 7.1
  • Feature detection of foreignObject in SVG
  • XSD with multi occurrences unordered
  • TFS - how do I sum child task hours to parent
  • Deploying a CodeRush plugin from the Community Site
  • How to pass solution folder as parameter in command line arguments (for debug)?
  • Private IP address in reserved subnet range
  • Specify the x-axis values in ggplot in R
  • ASP.NET MVC 2 Preview 2 - display directory list rather than home/index
  • x64 applications using gdi+: what are the consequences on performance?
  • Jetty 9 HashLoginService
  • Read a local file using javascript
  • Algorithm for a smudge tool?
  • jqPlot EnhancedLegendRenderer plugin does not toggle series for Pie charts
  • How do I rollback to a specific git commit
  • Is there a mandatory requirement to switch app.yaml?
  • Benchmarking RAM performance - UWP and C#
  • Checking variable from a different class in C#
  • Busy indicator not showing up in wpf window [duplicate]
  • How to load view controller without button in storyboard?