none
Why warning C4279 happens?

    Frage

  • Hi,

    I met the warning C4279 recently. The warning looks like;

    warning C4279: 'value': identifier in type library 'msxml6.dll' is a keyword; use the 'rename' qualifier

    I have read the MSDN from below link:

    http://msdn.microsoft.com/en-us/library/eszd7edh.aspx

    I know using the rename can resolve this issue. But I don't know how this warning is happening.

    Can anyone give me one sample code to explain how this warning produces? It would be better if you use the msxml6.dll for example.

    Thanks!

    Montag, 8. Juli 2013 06:15

Antworten

  • As you said, I don't think "value" is some kind of keyword in C++. I also have written one sample code to reproduce this warning, but failed (could not generate this warning after I "import "msxml6.dll" in my code).

    My guess is, the project where you see the warning is managed (using C++/CLI), while the project where you don't is native (using straight C++). "value" is kind of sort of a keyword in C++/CLI (the correct term is "contextual keyword", if I recall correctly); it seems the compiler might be a bit overzealous in issuing the warning.

    Igor Tandetnik

    Dienstag, 9. Juli 2013 12:33

Alle Antworten

  • warning C4279: 'value': identifier in type library 'msxml6.dll' is a keyword; use the 'rename' qualifier

    I know using the rename can resolve this issue. But I don't know how this warning is happening.

    The message seems pretty clear to me. The type library in msxml6.dll uses an identifier that happens to be a C++ keyword. You wouldn't be able to refer to this identifier in your C++ program, unless you rename it.

    Igor Tandetnik

    Montag, 8. Juli 2013 13:50
  • Hi,

    I met the warning C4279 recently. The warning looks like;

    warning C4279: 'value': identifier in type library 'msxml6.dll' is a keyword; use the 'rename' qualifier

    I have read the MSDN from below link:

    http://msdn.microsoft.com/en-us/library/eszd7edh.aspx

    I know using the rename can resolve this issue. But I don't know how this warning is happening.

    Can anyone give me one sample code to explain how this warning produces? It would be better if you use the msxml6.dll for example.

    Thanks!

    The warning message itself answers this question.  I.e a C++ keyword is used in msxml6.dll. You should rename it using rename. For example, you have a global function GetXml() and  in msxml6.dll also have same function defined then, there will have name collisions. To avoid this you should rename the GetXml() in msxml6.dll  to another name using rename attribute.

    #import "msxml3.dll" rename("GetXML","MSXMLGetXML") 


    Thanks, Renjith V R

    Montag, 8. Juli 2013 13:57
  • The message seems pretty clear to me. The type library in msxml6.dll uses an identifier that happens to be a C++ keyword. You wouldn't be able to refer to this identifier in your C++ program, unless you rename it.

    The thing is though, I don't believe 'value' is a C++ (or C++/CLI) keyword, just 'value class' and 'value struct'.

    David Wilkinson | Visual C++ MVP

    Montag, 8. Juli 2013 14:11
  • As you said, I don't think "value" is some kind of keyword in C++. I also have written one sample code to reproduce this warning, but failed (could not generate this warning after I "import "msxml6.dll" in my code).

    Can you help give one sample code to help reproduce generating this warning?

    Thanks.

    Dienstag, 9. Juli 2013 07:46
  • As you said, I don't think "value" is some kind of keyword in C++. I also have written one sample code to reproduce this warning, but failed (could not generate this warning after I "import "msxml6.dll" in my code).

    Can you help give one sample code to help reproduce generating this warning?

    Thanks.

    Check below post

    http://social.msdn.microsoft.com/Forums/en-US/cbeef774-3262-4f1c-a208-782dbd8af5af/having-msxml-warnings


    Thanks, Renjith V R

    Dienstag, 9. Juli 2013 08:02
  • As you said, I don't think "value" is some kind of keyword in C++. I also have written one sample code to reproduce this warning, but failed (could not generate this warning after I "import "msxml6.dll" in my code).

    My guess is, the project where you see the warning is managed (using C++/CLI), while the project where you don't is native (using straight C++). "value" is kind of sort of a keyword in C++/CLI (the correct term is "contextual keyword", if I recall correctly); it seems the compiler might be a bit overzealous in issuing the warning.

    Igor Tandetnik

    Dienstag, 9. Juli 2013 12:33
  • Thanks a lot for pointing this out! It is really the root cause of this warning!


    Mittwoch, 10. Juli 2013 05:53