FIX: LNK1170 Building Project's Makefile from Command LineLast reviewed: September 19, 1997Article ID: Q156190 |
The information in this article applies to:
SYMPTOMSWhen using the NMAKE utility to build a large project created in Visual C++, you may encounter the following error:
fatal error LNK1170: line in command file contains 16383 or more characters CAUSEVisual C++ generates the project makefile such that all of the object modules are placed on one line in an inline response file for LINK. LINK cannot accept more than 16383 characters on one line.
WORKAROUNDThere are two workarounds:
Workaround 1: A New MakefileCopy the project makefile and edit the copy. The object modules are listed in the LINK32_OBJS macro. To work around the problem, use macro substitution to insert newline charaters after each object module so that each object module is specified on a separate line. You need to use the following macro substitution in your project makefile:
$(LINK32_OBJS:" "="^ ")For example, a typical link line in a makefile looks similar to the following:
"$(OUTDIR)\anapp.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) $(LINK32) @<< $(LINK32_FLAGS) $(LINK32_OBJS) <<Change the third line of the above sample to the following:
"$(OUTDIR)\anapp.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) $(LINK32) @<< $(LINK32_FLAGS) $(LINK32_OBJS:" "="^ ") <<Notice the two white spaces between the initial set of quotes. You need to use the workaround for both the debug build and the release build of your project. If you have any other project configurations, you need to apply the workaround to those as well. Then use NMAKE on the new makefile to build your project.
Workaround 2: Static LibrariesBreak up your project into a main top-level project and several static libraries as sub-projects. Static libraries are simply a collection of object modules. You can organize your project into several such collections, but you must have at least one module in your top-level project--the one containing the entry point of your program.
STATUSMicrosoft has confirmed this to be an issue in the Microsoft products listed at the beginning of this article. This bug was corrected in Visual C++ version 5.0.
REFERENCESVisual C++ version 4.2, Visual C++ Books Online; click Visual C++ Books, User's Guides, Visual C++ User's Guide, Working with Projects, Using Projects, and then click the "Inserting and Deleting Projects" topic. Visual C++ version 4.2, Visual C++ Books Online; click Visual C++ Books, User's Guides, Visual C++ User's Guide, NMAKE Reference, and then the "NMAKE Reference" topic. Visual C++ version 4.2, Visual C++ Books Online; click Visual C++ Books, User's Guides, Visual C++ User's Guide, Working with Projects, Managing Project Workspaces, Creating a Project Workspace, and the "Project Types" topic. Visual C++ version 4.2, Visual C++ Books Online; click Visual C++ Books, User's Guides, Visual C++ User's Guide, NMAKE Reference, Macros and NMAKE, Using an NMAKE Macro, and then click the "Macro Substitution" topic.
|
Additional query words: 1.61.6038
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |