Click here to Skip to main content
16,017,502 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Overload -> operator Pin
Andy Bantly29-Jun-17 6:28
Andy Bantly29-Jun-17 6:28 
QuestionTrying to understand this article on why auto_ptr has been deprecated Pin
swampwiz6-Jun-17 6:45
swampwiz6-Jun-17 6:45 
AnswerRe: Trying to understand this article on why auto_ptr has been deprecated Pin
leon de boer6-Jun-17 9:49
leon de boer6-Jun-17 9:49 
QuestionMessage Closed Pin
2-Jun-17 20:55
Member 132002172-Jun-17 20:55 
Questionbuilding the assimp library Pin
PierreBokma25-May-17 10:01
PierreBokma25-May-17 10:01 
AnswerRe: building the assimp library Pin
Richard MacCutchan25-May-17 20:48
mveRichard MacCutchan25-May-17 20:48 
AnswerRe: building the assimp library Pin
RedDk26-May-17 8:19
RedDk26-May-17 8:19 
QuestionC2011 ‘vc_sttributes::YesNoMaybe’ “ ‘enum’ type redefinition RESOLVED Pin
bkelly1321-May-17 21:12
bkelly1321-May-17 21:12 
Resolution: In the environment variables for include and lib there were three copies of one directory. That lead to the deletion of some other items. I suspect those three copies were the results of multiple upgrades and installs beginning with VS 2005.


Windows 7, visual Studio 2010, C++, MFC
I posted this on MDSD a week ago and have no replies. The essence is that definitions from within Visual Studio are showing up as being redefined. I do not have direct control over these and cannot find the indirect control / problem / defect that I have managed to insert in the code.

Here is the first of a long list of errors in the Output window

1>c:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\
sourceannotations.h(57) error c2011: 
'vc_attributes::YesNoMaybe' : 'enum' type redefinition


First, I cannot copy/paste from my working computer to my internet computer so please excuse any typos. If you see one, feel free to mention it as there may be an error, but please do not reject everything out of hand due to typos.

I searched for this problem and found several results, including an unanswered question from 2008 here:

https://social.msdn.microsoft.com/Forums/en-US/fb887af6-45dc-42b9-94bb-ab4d08a16dd8/64bit-compiler-error?forum=Vsexpressvc

It included advice to clean and rebuild. Following said advice I did a “Clean.” Then I closed Visual Studio entirely and ran a batch file I have named clean.bat that deletes 14 types of files in the solution directory and all subdirectories followed by a rebuild. A restart of VS and a build produces the same problem.

The titular error and similar errors are repeated numerous times.

Edit: to complete the title the entire error is (with a couple of CRs added for readibility:

1> winnocc.cpp

1>c:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\
sourceannotations.h(57) error c2011: 
'vc_attributes::YesNoMaybe' : 'enum' type redefinition


Much further down in the error list is found:

… message_constants.h(50): error C2370: ‘NO_NAME_SPECIFIED’ : redefinition; different storage class
That particular file begins with

#pragma once
The constant is referenced one time only in the entire project, and that reference is within the same file.

So,…, I surmise that the #pragma once is not working. Maybe I did something to defeat it, I don’t know.

So, …, I added these lines to the start of the file, just below the pragma once

#ifndef MESSAGE_CONSTANTS
#define MESSAGE_CONSTANTS
… entire file contents …
#end if

Then, just to be certain, in every file that references this file I added these lines just above and below the include

#ifndef MESSAGE_CONSTANTS
#include message_constants.h
#endif

Question: What have I done wrong to incur such wrath upon myself?

Edit 2 hours after initial post

While trying to chase down this problem I discovered that the file name is really Message_Constants.h. When I chase down the error the file name at the top of the edit windows shows the name "message_constants.h" It also shows "Message_Constants.h" What is with the all lower case versus the leading caps?

I execute a Save As to ascertain the actual location and it is as expected. Open Windows explorer and it finds "Message_Constants.h and it does not find "message_constants.h" Now I have changed all occurrences to use the leading caps version but this problem remains.

Edit Again

I looked at file sourceannotations.h and found #pragma once. So I added the standard guard macros as presented earlier and they made no difference.

Monday, 22 May Edit
I added the /showIncludes options. Below is the lead in to the first error message. Again, I cannot cut paste so a few typos may be present. And just in case it might be significant: Where I wrote (indented here) means that that line was indented in my output window but this system is not showing an indentation.

Each line is prefixed with the two characters: 1>. None progress to 2>
Quote:

C1compile
All outputs are up-to-date.
stdafx.cpp
winocc.cpp
Note: including file: C:\Program Files Microsoft Visual Studio 9.0\VC\atlmfc\src\mfc\occimpl.h
Note: including file: C:\Program Files Microsoft Visual Studio 10.0\VC\atlmfc\include\atldbcli.h
Note: including file: C:\Program Files Microsoft Visual Studio v7.0A\include\oledberr.h
Note: including file: C:\Program Files Microsoft Visual Studio v7.0A\include\msdaguid.h
Note: including file: C:\Program Files Microsoft Visual Studio v7.0A\include\msdasc.h
Note: including file: C:\Program Files Microsoft Visual Studio 9.0\VC\include\sal.h
Note: including file: C:\Program Files Microsoft Visual Studio 9.0\VC\include\codeanalysis\sourceannotations.h
c:\program files\Microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h(57): error c2011: 'vc_attributes::YesNoMaybe' : 'enum' type redefinition
(indented here) c:\program files\Microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(57) " see declaration of 'vc_attributes:: YesNoMaybe'


Thank you for your time



modified 22-May-17 17:55pm.

AnswerRe: C2011 ‘vc_sttributes::YesNoMaybe’ “ ‘enum’ type redifinition Pin
Richard MacCutchan21-May-17 22:34
mveRichard MacCutchan21-May-17 22:34 
AnswerRe: C2011 ‘vc_sttributes::YesNoMaybe’ “ ‘enum’ type redifinition Pin
Jochen Arndt21-May-17 23:38
professionalJochen Arndt21-May-17 23:38 
AnswerRe: C2011 ‘vc_sttributes::YesNoMaybe’ “ ‘enum’ type redifinition Pin
Randor 22-May-17 0:29
professional Randor 22-May-17 0:29 
GeneralRe: C2011 ‘vc_sttributes::YesNoMaybe’ “ ‘enum’ type redifinition Pin
bkelly1322-May-17 3:44
bkelly1322-May-17 3:44 
GeneralRe: C2011 ‘vc_sttributes::YesNoMaybe’ “ ‘enum’ type redifinition Pin
Randor 22-May-17 5:15
professional Randor 22-May-17 5:15 
GeneralRe: C2011 ‘vc_sttributes::YesNoMaybe’ “ ‘enum’ type redifinition Pin
bkelly1322-May-17 10:28
bkelly1322-May-17 10:28 
GeneralRe: C2011 ‘vc_sttributes::YesNoMaybe’ “ ‘enum’ type redifinition Pin
Randor 22-May-17 11:18
professional Randor 22-May-17 11:18 
GeneralRe: C2011 ‘vc_sttributes::YesNoMaybe’ “ ‘enum’ type redifinition Pin
bkelly1322-May-17 11:53
bkelly1322-May-17 11:53 
GeneralRe: C2011 ‘vc_sttributes::YesNoMaybe’ “ ‘enum’ type redifinition Pin
leon de boer22-May-17 19:49
leon de boer22-May-17 19:49 
GeneralRe: C2011 ‘vc_sttributes::YesNoMaybe’ “ ‘enum’ type redifinition Pin
Richard Andrew x6428-May-17 15:11
professionalRichard Andrew x6428-May-17 15:11 
GeneralRe: C2011 ‘vc_sttributes::YesNoMaybe’ “ ‘enum’ type redifinition Pin
leon de boer28-May-17 16:37
leon de boer28-May-17 16:37 
GeneralRe: C2011 ‘vc_sttributes::YesNoMaybe’ “ ‘enum’ type redifinition Pin
Richard Andrew x6429-May-17 3:24
professionalRichard Andrew x6429-May-17 3:24 
GeneralRe: C2011 ‘vc_sttributes::YesNoMaybe’ “ ‘enum’ type redifinition Pin
Randor 29-May-17 9:57
professional Randor 29-May-17 9:57 
GeneralRe: C2011 ‘vc_sttributes::YesNoMaybe’ “ ‘enum’ type redifinition Pin
leon de boer29-May-17 18:12
leon de boer29-May-17 18:12 
GeneralRe: C2011 ‘vc_sttributes::YesNoMaybe’ “ ‘enum’ type redifinition Pin
leon de boer29-May-17 18:02
leon de boer29-May-17 18:02 
AnswerRe: C2011 ‘vc_sttributes::YesNoMaybe’ “ ‘enum’ type redifinition Pin
Randor 29-May-17 9:50
professional Randor 29-May-17 9:50 
GeneralRe: C2011 ‘vc_sttributes::YesNoMaybe’ “ ‘enum’ type redifinition Pin
leon de boer22-May-17 5:27
leon de boer22-May-17 5:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.