none
Bug in VS2019 IntelliSense RRS feed

  • General discussion

  • I created a Visual Studio 2019 C++ project and imported 1 header file that already existed.  That file looked something like this:

    #if !defined( MY_INCLUDE_GUARD )
        #define MY_INCLUDE_GUARD
    
        #if defined( _WIN32 ) || defined( WIN32 )
            /*
                When compiling on Windows
            */
        
            #if defined( _WIN64 )
                /* 
                    Windows architecture test for 64-bit
                */
            #else
                // 32-bit architecture
            
                /*
                    End of Windows System Architecture check
                */
            #endif
        #elif defined( __posix__ ) || defined( __linux__ ) || defined( __unix__ )
            /*
                Versus compiling on POSIX-compliant systems
            */
            
            #if defined( __x86_64__ ) || defined( __ppc64__ )
                /*
                    GNU/GCC architecture test for 64-bit
                */
            #else
                // 32-bit architecture
                
                /*
                    End of POSIX System Architecture check
                */
            #endif
        #else
            // Specify unsupported platform
            
            /*
                End of platform check
            */
        #endif
    
    /*
        End of file include guard
    */
    #endif

    At the very last line of this header file (#endif), VS2019 IntelliSense indicated "Unrecognized preprocessor directive."  I've seen a kind of lag in VS2019 for C++ before, where a build fixes the logic problem, but in this case it prevented the build instead.

    At the same time, VS2019 indicated that the very first line of this header file (the #if !defined( MY_INCLUDE_GUARD) had an error indicating there was no closing #endif.

    So the example presented obviously isn't the original file that presented the error.  I put this header example together specifically and clearly to demonstrate the problem when I posted to MSDN (as with all my other code, I wrote the header out in a text editor that works a lot better than VS2019 and then imported the file into a VS2019 project to compile it).

    With absolutely 0 (zero) changes except that this second header file was added to the project, the errors in the original codefile disappeared.  So I submit that this is pretty clearly a bug.



    Wednesday, June 19, 2019 6:06 PM

All replies

  • I created a Visual Studio 2019 C++ project and imported 1 header file that already existed.  That file looked something like this:
    ...
    At the very last line of this header file (#endif), VS2019 IntelliSense indicated "Unrecognized preprocessor directive."

    I've copy/pasted your example into a header file, added it to a console project and included it from the cpp source module.
    I don't see any such error using the current latest preview of VS2019 16.2. The project builds fine for me.

    Can you supply a minimal complete example solution/project that reproduces the problem for you?

    Dave

    Wednesday, June 19, 2019 10:54 PM