An engineer that I work with had the error “cl : Command line error D2004 : '/I' requires an argument” this week. He had copied a folder from a project that we received from third party and was working on integrating it into one of our projects, so he wasn’t familiar with the contents of the folder. If you are actually working on making changes to the project, this error is probably easier to figure out.
The first hint at what the problem is and where to look for it is the two words, “Command line”.   Given that, I recommended looking in the build.log file so that we could analyze the command line.
The second hint is that ‘/I’ requires an argument. If you are familiar with the command line arguments for the compiler, then you probably already know that ‘/I’ is used to define the search path for header files. Give that ‘/I’ defines the header file search path, and that nmake uses the environment variable INCLUDES to set the include path we could probably jump ahead and start looking at how INCLUDES is defined.
Sure enough, when we looked in the build.log file we found “-I -IC:\WINCE600…” on the command line as we expected.
Looking in the sources file, we found:
 At first look, we knew that was just plain goofy. But what about it is wrong? What is wrong can be discovered by referring back to the command line, “INCLUDES=$(INCLUDES);”, where we notice that there are more header file folders defined on using ‘-I’ after the problem. That can only mean that after this sources file sets INCLUDES, something else adds to the INCLUDES and when it adds more, it also adds a semi-colon. So it must look like this:
Which would expand to <some paths>;;c:\WINCE600… which has to semi-colons back to back. That doesn’t get handled correctly when creating the command line.
The solution for this example was easy, just remove the line from the source file. The lesson here is that when setting INCLUDES, don’t put a semi-colon on the end.
For more on the Platform Builder build system take a look at: Summary of Building Windows CE which lists the articles that I have written about building Windows CE using Platform Builder.
Copyright © 2009 – Bruce Eitman
All Rights Reserved