FIX: Two #ident or #pragma Comment Statements May Cause L5000

ID: Q104647

1.00 WINDOWS kbtool kbfixlist kbbuglist

The information in this article applies to:

SYMPTOMS

When using two #ident preprocessor directives or #pragma comments to insert two comments into an executable file, the linker generates an L5000 error when the second comment is longer than 20 characters.

RESOLUTION

There are a three workarounds:

- Compile with the optimizing compiler (/f-).

  -or-

  • Instead of using a #ident or #pragma comment, declare a literal character string in your application:

          char trademark[50]="Your trademarked name goes here"
    

    This will make the phrase "Your trademarked name goes here" appear in the executable file as well.

    STATUS

    Microsoft has confirmed this to be a problem in the Microsoft products listed above. This is not a problem in Visual C++, 32-bit Edition. This problem was corrected in Visual C++ for Windows, version 1.0.

    MORE INFORMATION

    The comments #ident "This is a comment" and #pragma comment(exestr,"This is a comment") both place the phrase "This is a comment" into the executable file. This comment can be seen when the .EXE file is viewed within an editor, and is often used for copyright protection.

    The first line can be longer than 20 characters and not generate the L5000 error.

    Sample Code

    /* Compile options needed: /f- to fix problem
    */ 
    
    
    #ident "a" #ident "now is the time for a"

    void main(void)
    
    { }

    Additional reference words: 1.00 8.00 KBCategory: kbtool kbfixlist kbbuglist KBSubcategory: CLIss

    Keywords          : kb16bitonly kbCompiler kbbuglist kbfixlist
    Version           : 1.00
    Platform          : WINDOWS
    Solution Type     : kbfix

    Last Reviewed: September 20, 1997