DEV Community

Mattias Cibien
Mattias Cibien

Posted on

Upgrading from Visual C++ 6.0: The $(InputFile) macro

When trying to compile code that used to run under Visual C++ 6.0 you actually have to face some quirks which resides in custom build tools. One of these is the $(InputFile) macro producing linking errors like cannot find input file '.\debug\.obj'.

As the geek I tend to be, I like to do a lot of crazy things including compiling old games with the modern compiler.

Quite some time ago, when I was compiling the code of Quake under Visual C++ 2015, I faced the same problem I had with older versions of the IDE: when the linker tries to link the output files of the Assembler, if fails with an error code similar to this:

Error: cannot find input file '.\debug\.obj'

The problem arises since the macro $(InputFile) is not available anymore in modern Visual C++ versions and therefore it produces an empty string as output. The conversion process, moreover, does not manage to convert the macro occurrences in the Outputs property of the Custom Build Tool.

Fixing this is as simple as opening the Properties of the files, and looking into the Outputs of the custom build tool and replace the occurrences of $(InputFile) with the new %(FileName) macro which achieves the same effect. A screenshot of the final result can be seen in the image.

Alt Text

Hope that this trick will help you in bringing your old code into the new age.

Top comments (0)