CRT functions met with IntelliSense Problem

Hi all,

Recently I met with some IntelliSense problem with Visual Studio C++ 2005.

When I type function name, ie, _beginthreadex, Visual Studio cannot provide parameter list, and the following message are shown in status bar:

IntelliSense: 'Could not resolve identifier'.

Is that mean CRT is not supported by IntelliSense please help.


Answer this question

CRT functions met with IntelliSense Problem

  • tballx

    Well, for me it seems to affect only _beginthread, _beginthreadex, _endthread and _endthreadex. I haven't tried others from process.h, but other crt functions are working fine. This includes other functions with underscore as the first character. I've used it for _tcscpy and others like that, but then again, they are defined to be alternate definitions for strcpy and wcscpy depending on if UNICODE is defined or not.

    From the looks of it, they are not defined because for some reason _MT isn't defined in the process.h file. In my project settings it is set to /MDd and according to msdn _MT is defined when a multithreaded library is used, like /MDd.
    I added /D "_MT" to the command line myself and it started picking up these functions in the intellisense, so it just seems that there is _MT isn't being defined when it should be.



  • VSU

    It does, but in the IDE itself the text gets greyed out. I've noticed that this happens when the IDE doesn't see something as being defined. So the only thing I can think is the matter is that even though _MT gets defined by the compiler, it isn't seen as defined by the IDE.



  • Sarah Roberts

    Hi:

    Couple of questions:

    Is this with CRT functions only, or does it also happen with SDK/MFC functions

    Can you compile and run a simple printf hello world program using /MD (dynamic CRT) and /MT (static CRT)

    Was it working at one point and then stopped working, or has this been an issue from the beginning   Is this happening with all projects or just a particular project   If all projects, can you duplicate with a brand new project

    Does uninstalling Visual C++ and reinstalling have any effect on the problem

    Best Regards,



  • SpliCEd

    /MT is the default if no CRT is specified, and all options for the CRT (/MT, /MTd, /MD, /MDd) are multithreaded.  Therefore, the macro _MT is in effect pre-defined for all.

    It seems odd that adding /D_MT to your command line apparently resolves the problem.

    Try this:
    #ifdef _MT
    #pragma message("_MT is defined");
    #endif

    compile the above and see if the message displays (it does for me).





  • RTEKI

    Well, I see the same thing in a newly generated app-wizard Win32 console app.  This looks like a bug in intellisense to me and I have reported it to development.

    Here is a way to observe the problem - it need not be process.h, just any header file for which there is a #ifdef _MT block.  stdio.h will illustrate - consider the following snippet from stdio.h:

    #ifdef _MT
    _CRTIMP void __cdedl _lock_file(__inout FILE * _File);
    _CRTIMP void __cdedl _unlock_file(__inout FILE * _File);
    #else
    #define _lock_file(c)
    #define _unlock_file(c)
    #endif

    No matter what the CRT setting (/MT{d} or /MD{d}), if you open stdio.h in the IDE (right click on it in stdafx.h and select open the file), the block inside #ifdef _MT is greyed out, and intellisense is not enabled properly for _lock_file or _unlock_file.  If you add the code in my earlier post to print a message if _MT is defined, the message prints.  So _MT is defined, and the compiler knows that, but intellisense does not.

    The workaround, as mentioned in the original post is to add _MT to your preprocessor defines in the property page for the configuration you are working with (adds /D_MT to the compile line).  As soon as you do that, intellisense will work for the _MT defined functions (and the same message prints when the code is compiled).

    Best Regards,



  • ToshibaT1

    Well I tried other functions in process.h in a new project, and found that only functions defined in #ifdef _MT and #endif have this problem.

    I set the Runtime Library property to "Multi-threaded(/MT)" but it doesn't help.

    I think this just happens by chance, anyway, IntelliSense in Visual C++ works a little worse than in Visual C# now.

    Thanks for your attentions.

  • CRT functions met with IntelliSense Problem