Compiling bug?

alright, now i get just another error. its very weird. it doesnt matter if i build on the VS2005 prof edition, or the express edition. anyway...

public ref class CTree

{

private:

ArrayList^ _TreeNodes;

public:

CTree() {}

void AddTreeNode(VCNode^ Node){

TreeNodes->Add(Node);

}

void Repaint(TreeView^ Tree){

for (int i = 0; i <= _TreeNodes->Items->Count; i++){

if (_TreeNodes->ItemsIdea->Type==VCNode::typeid){

VCNode^ TempNode = _TreeNodes->ItemsIdea;

Tree->Nodes->Add(TempNode->Node);

}

}

}

 

now, when i compile, i get a error that VCNode doesnt excist. this error is only for Repaint, and not for AddTreeNode. I tried everything. but its just that as soon as i create a new function in my class witch's using VCNode, i get an error.

anyone know the reason of this bug

 

 

even more bugs

 

When i add a new component. he defines it 4 times in the source. every new auto created source is defined 4 times. same as in the error window. i got each error message 4 times.



Answer this question

Compiling bug?

  • GPK2005

    I don't see that VCNode is fully known to the compiler. You just have a forward reference to is. Either you have to include the header, or you have to reference the file by the #using directive.

  • Jin Feng - MSFT

    I gave the answer. You just said that there is a ref class VCNode. But the compiler doesn't know that there is a typeid member for it! You might say that this is logical for a ref class but the compiler makes no assumption about that, because the user might redefine it in the final declaration!

  • clearlydotnet2

    Sorry I can't see the definition of VCnode in this class. Show us the complete class. Do you have the class deifned more than once in different namespaces Show more code.

  • cdonner

    Hello, I have a similar problem, with the same exact error message with the designer. I've looked through my forms code and I can't find anything out of the ordinary, so here it is. (If you need me to post the Load event (FormLoad) body and the Click event (exit menu item click) body ill do so)

    #pragma once

    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System:Big Smileata;
    using namespace System:Big Smilerawing;


    namespace DCOMProductions {
    namespace InteractiveTeamSystem {
    namespace ITSDev {

    /// <summary>
    /// Summary for FormTextEdit
    ///
    /// WARNING: If you change the name of this class, you will need to change the
    /// 'Resource File Name' property for the managed resource compiler tool
    /// associated with all .resx files this class depends on. Otherwise,
    /// the designers will not be able to interact properly with localized
    /// resources associated with this form.
    /// </summary>
    public ref class FormTextEdit : public System::Windows::Forms::Form
    {
    public:
    FormTextEdit(void)
    {
    InitializeComponent();
    //
    //TODO: Add the constructor code here
    //
    }

    protected:
    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    ~FormTextEdit()
    {
    if (components)
    {
    delete components;
    }
    }

    private: System::Windows::Forms::MenuStrip^ menuStripMain;
    private: System::Windows::Forms::RichTextBox^ rtxtData;
    private: System::Windows::Forms::ContextMenuStrip^ rtxtMenu;
    private: System::Windows::Forms::ToolStripMenuItem^ boldToolStripMenuItem;
    private: System::Windows::Forms::ToolStripMenuItem^ italicToolStripMenuItem;
    private: System::Windows::Forms::ToolStripMenuItem^ underlinedToolStripMenuItem;
    private: System::Windows::Forms::ToolStripMenuItem^ strikeoutToolStripMenuItem;
    private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator1;
    private: System::Windows::Forms::ToolStripComboBox^ cbFontFamily;
    private: System::Windows::Forms::ToolStripComboBox^ cbFontSize;
    private: System::Windows::Forms::ToolStripComboBox^ cbFontColor;
    private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator2;
    private: System::Windows::Forms::ToolStripMenuItem^ cutToolStripMenuItem;
    private: System::Windows::Forms::ToolStripMenuItem^ copyToolStripMenuItem;
    private: System::Windows::Forms::ToolStripMenuItem^ pasteToolStripMenuItem;
    private: System::Windows::Forms::ToolStripMenuItem^ selectAllToolStripMenuItem;
    private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator3;
    private: System::Windows::Forms::ToolStripMenuItem^ wordWrapToolStripMenuItem;
    private: System::Windows::Forms::ToolStripMenuItem^ fileToolStripMenuItem;
    private: System::Windows::Forms::ToolStripMenuItem^ exitToolStripMenuItem;

    private:
    /// <summary>
    /// Required designer variable.
    /// </summary>
    private: System::ComponentModel::Container^ components;

    #pragma region Windows Form Designer generated code
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    void InitializeComponent(void)
    {
    System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(FormTextEdit::typeid));
    this->menuStripMain = (gcnew System::Windows::Forms::MenuStrip());
    this->fileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    this->exitToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    this->rtxtData = (gcnew System::Windows::Forms::RichTextBox());
    this->rtxtMenu = (gcnew System::Windows::Forms::ContextMenuStrip(this->components));
    this->boldToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    this->italicToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    this->underlinedToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    this->strikeoutToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    this->toolStripSeparator1 = (gcnew System::Windows::Forms::ToolStripSeparator());
    this->cbFontFamily = (gcnew System::Windows::Forms::ToolStripComboBox());
    this->cbFontSize = (gcnew System::Windows::Forms::ToolStripComboBox());
    this->cbFontColor = (gcnew System::Windows::Forms::ToolStripComboBox());
    this->toolStripSeparator2 = (gcnew System::Windows::Forms::ToolStripSeparator());
    this->cutToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    this->copyToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    this->pasteToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    this->selectAllToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    this->toolStripSeparator3 = (gcnew System::Windows::Forms::ToolStripSeparator());
    this->wordWrapToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    this->menuStripMain->SuspendLayout();
    this->rtxtMenu->SuspendLayout();
    this->SuspendLayout();
    //
    // menuStripMain
    //
    this->menuStripMain->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) {this->fileToolStripMenuItem});
    this->menuStripMain->Location = System:Big Smilerawing:Stick out tongueoint(0, 0);
    this->menuStripMain->Name = L"menuStripMain";
    this->menuStripMain->RenderMode = System::Windows::Forms::ToolStripRenderMode:Tongue Tiedystem;
    this->menuStripMain->Size = System:Big Smilerawing:Tongue Tiedize(570, 24);
    this->menuStripMain->TabIndex = 0;
    //
    // fileToolStripMenuItem
    //
    this->fileToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) {this->exitToolStripMenuItem});
    this->fileToolStripMenuItem->Name = L"fileToolStripMenuItem";
    this->fileToolStripMenuItem->Size = System:Big Smilerawing:Tongue Tiedize(35, 20);
    this->fileToolStripMenuItem->Text = L"File";
    //
    // exitToolStripMenuItem
    //
    this->exitToolStripMenuItem->Name = L"exitToolStripMenuItem";
    this->exitToolStripMenuItem->Size = System:Big Smilerawing:Tongue Tiedize(103, 22);
    this->exitToolStripMenuItem->Text = L"Exit";
    this->exitToolStripMenuItem->Click += gcnew System::EventHandler(this, &FormTextEdit::ExitTextEditor);
    //
    // rtxtData
    //
    this->rtxtData->ContextMenuStrip = this->rtxtMenu;
    this->rtxtData->Dock = System::Windows::Forms:Big SmileockStyle::Fill;
    this->rtxtData->Location = System:Big Smilerawing:Stick out tongueoint(0, 24);
    this->rtxtData->Name = L"rtxtData";
    this->rtxtData->Size = System:Big Smilerawing:Tongue Tiedize(570, 253);
    this->rtxtData->TabIndex = 1;
    this->rtxtData->Text = L"";
    //
    // rtxtMenu
    //
    this->rtxtMenu->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(15) {this->boldToolStripMenuItem,
    this->italicToolStripMenuItem, this->underlinedToolStripMenuItem, this->strikeoutToolStripMenuItem, this->toolStripSeparator1,
    this->cbFontFamily, this->cbFontSize, this->cbFontColor, this->toolStripSeparator2, this->cutToolStripMenuItem, this->copyToolStripMenuItem,
    this->pasteToolStripMenuItem, this->selectAllToolStripMenuItem, this->toolStripSeparator3, this->wordWrapToolStripMenuItem});
    this->rtxtMenu->Name = L"rtxtMenu";
    this->rtxtMenu->ShowCheckMargin = true;
    this->rtxtMenu->ShowImageMargin = false;
    this->rtxtMenu->Size = System:Big Smilerawing:Tongue Tiedize(186, 317);
    //
    // boldToolStripMenuItem
    //
    this->boldToolStripMenuItem->CheckOnClick = true;
    this->boldToolStripMenuItem->Font = (gcnew System:Big Smilerawing::Font(L"Tahoma", 8.25F, System:Big Smilerawing::FontStyle::Bold));
    this->boldToolStripMenuItem->Name = L"boldToolStripMenuItem";
    this->boldToolStripMenuItem->Size = System:Big Smilerawing:Tongue Tiedize(185, 22);
    this->boldToolStripMenuItem->Text = L"Bold";
    //
    // italicToolStripMenuItem
    //
    this->italicToolStripMenuItem->CheckOnClick = true;
    this->italicToolStripMenuItem->Font = (gcnew System:Big Smilerawing::Font(L"Tahoma", 8.25F, System:Big Smilerawing::FontStyle::Italic));
    this->italicToolStripMenuItem->Name = L"italicToolStripMenuItem";
    this->italicToolStripMenuItem->Size = System:Big Smilerawing:Tongue Tiedize(185, 22);
    this->italicToolStripMenuItem->Text = L"Italic";
    //
    // underlinedToolStripMenuItem
    //
    this->underlinedToolStripMenuItem->CheckOnClick = true;
    this->underlinedToolStripMenuItem->Font = (gcnew System:Big Smilerawing::Font(L"Tahoma", 8.25F, System:Big Smilerawing::FontStyle::Underline));
    this->underlinedToolStripMenuItem->Name = L"underlinedToolStripMenuItem";
    this->underlinedToolStripMenuItem->Size = System:Big Smilerawing:Tongue Tiedize(185, 22);
    this->underlinedToolStripMenuItem->Text = L"Underlined";
    //
    // strikeoutToolStripMenuItem
    //
    this->strikeoutToolStripMenuItem->CheckOnClick = true;
    this->strikeoutToolStripMenuItem->Font = (gcnew System:Big Smilerawing::Font(L"Tahoma", 8.25F, System:Big Smilerawing::FontStyle:Tongue Tiedtrikeout));
    this->strikeoutToolStripMenuItem->Name = L"strikeoutToolStripMenuItem";
    this->strikeoutToolStripMenuItem->Size = System:Big Smilerawing:Tongue Tiedize(185, 22);
    this->strikeoutToolStripMenuItem->Text = L"Strikeout";
    //
    // toolStripSeparator1
    //
    this->toolStripSeparator1->Name = L"toolStripSeparator1";
    this->toolStripSeparator1->Size = System:Big Smilerawing:Tongue Tiedize(182, 6);
    //
    // cbFontFamily
    //
    this->cbFontFamily->AutoSize = false;
    this->cbFontFamily->DropDownStyle = System::Windows::Forms::ComboBoxStyle:Big SmileropDownList;
    this->cbFontFamily->FlatStyle = System::Windows::Forms::FlatStyle:Tongue Tiedystem;
    this->cbFontFamily->Margin = System::Windows::Forms:Stick out tongueadding(8, 2, 2, 2);
    this->cbFontFamily->Name = L"cbFontFamily";
    this->cbFontFamily->Size = System:Big Smilerawing:Tongue Tiedize(125, 21);
    //
    // cbFontSize
    //
    this->cbFontSize->AutoSize = false;
    this->cbFontSize->DropDownStyle = System::Windows::Forms::ComboBoxStyle:Big SmileropDownList;
    this->cbFontSize->FlatStyle = System::Windows::Forms::FlatStyle:Tongue Tiedystem;
    this->cbFontSize->Items->AddRange(gcnew cli::array< System:Surprisebject^ >(14) {L"8", L"10", L"12", L"14", L"16", L"18", L"20",
    L"22", L"24", L"26", L"32", L"48", L"64", L"72"});
    this->cbFontSize->Margin = System::Windows::Forms:Stick out tongueadding(8, 2, 2, 2);
    this->cbFontSize->Name = L"cbFontSize";
    this->cbFontSize->Size = System:Big Smilerawing:Tongue Tiedize(125, 21);
    //
    // cbFontColor
    //
    this->cbFontColor->AutoSize = false;
    this->cbFontColor->DropDownStyle = System::Windows::Forms::ComboBoxStyle:Big SmileropDownList;
    this->cbFontColor->FlatStyle = System::Windows::Forms::FlatStyle:Tongue Tiedystem;
    this->cbFontColor->Items->AddRange(gcnew cli::array< System:Surprisebject^ >(12) {L"Aqua", L"Black", L"Blue", L"Gray", L"Green",
    L"Navy", L"Orange", L"Pink", L"Purple", L"Red", L"Silver", L"Yellow"});
    this->cbFontColor->Margin = System::Windows::Forms:Stick out tongueadding(8, 2, 2, 2);
    this->cbFontColor->Name = L"cbFontColor";
    this->cbFontColor->Size = System:Big Smilerawing:Tongue Tiedize(125, 21);
    //
    // toolStripSeparator2
    //
    this->toolStripSeparator2->Name = L"toolStripSeparator2";
    this->toolStripSeparator2->Size = System:Big Smilerawing:Tongue Tiedize(182, 6);
    //
    // cutToolStripMenuItem
    //
    this->cutToolStripMenuItem->Name = L"cutToolStripMenuItem";
    this->cutToolStripMenuItem->Size = System:Big Smilerawing:Tongue Tiedize(185, 22);
    this->cutToolStripMenuItem->Text = L"Cut";
    //
    // copyToolStripMenuItem
    //
    this->copyToolStripMenuItem->Name = L"copyToolStripMenuItem";
    this->copyToolStripMenuItem->Size = System:Big Smilerawing:Tongue Tiedize(185, 22);
    this->copyToolStripMenuItem->Text = L"Copy";
    //
    // pasteToolStripMenuItem
    //
    this->pasteToolStripMenuItem->Name = L"pasteToolStripMenuItem";
    this->pasteToolStripMenuItem->Size = System:Big Smilerawing:Tongue Tiedize(185, 22);
    this->pasteToolStripMenuItem->Text = L"Paste";
    //
    // selectAllToolStripMenuItem
    //
    this->selectAllToolStripMenuItem->Name = L"selectAllToolStripMenuItem";
    this->selectAllToolStripMenuItem->Size = System:Big Smilerawing:Tongue Tiedize(185, 22);
    this->selectAllToolStripMenuItem->Text = L"Select All";
    //
    // toolStripSeparator3
    //
    this->toolStripSeparator3->Name = L"toolStripSeparator3";
    this->toolStripSeparator3->Size = System:Big Smilerawing:Tongue Tiedize(182, 6);
    //
    // wordWrapToolStripMenuItem
    //
    this->wordWrapToolStripMenuItem->Checked = true;
    this->wordWrapToolStripMenuItem->CheckOnClick = true;
    this->wordWrapToolStripMenuItem->CheckState = System::Windows::Forms::CheckState::Checked;
    this->wordWrapToolStripMenuItem->Name = L"wordWrapToolStripMenuItem";
    this->wordWrapToolStripMenuItem->Size = System:Big Smilerawing:Tongue Tiedize(185, 22);
    this->wordWrapToolStripMenuItem->Text = L"Word Wrap";
    //
    // FormTextEdit
    //
    this->AutoScaleDimensions = System:Big Smilerawing:Tongue TiedizeF(6, 13);
    this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
    this->ClientSize = System:Big Smilerawing:Tongue Tiedize(570, 277);
    this->Controls->Add(this->rtxtData);
    this->Controls->Add(this->menuStripMain);
    this->MainMenuStrip = this->menuStripMain;
    this->Name = L"FormTextEdit";
    this->Text = L"Text Editor";
    this->Load += gcnew System::EventHandler(this, &FormTextEdit::FormTextEdit_Load);
    this->menuStripMain->ResumeLayout(false);
    this->menuStripMain->PerformLayout();
    this->rtxtMenu->ResumeLayout(false);
    this->ResumeLayout(false);
    this->PerformLayout();

    }
    #pragma endregion
    private: System::Void ExitTextEditor(System:Surprisebject^ sender, System::EventArgs^ e);
    private: System::Void FormTextEdit_Load(System:Surprisebject^ sender, System::EventArgs^ e);
    };
    }
    }
    }



  • al2torres

    Alright, i putted the definition of VCNode above the tree class and it all worked fine.... this doesnt have any kind of logical explanation. I hope someone can tell me what i did wrong, anyway, at least i can go on with my program now
  • Dinesh Kulkarni - MSFT

    ah sorry ;P didnt see the last part of your previous reply. thanks anyway. i now know the reason of this annoying problem.
  • Kranti

    Where is VCNode defined Is the reference to this assembly set

  • Vi_High_0017

    ref class VCNode;

    VCNode is declared and defined in the same file, see the header


  • Mindaugas Luko?ius

    ofcourse, thats my point. vcnode is defined under this class. in the first function, VCNode works fine. if i add a new function in the same class. he give's a error. thats the weird thing
  • thedawn

    http://polity.magnoon.nl/Other/Engine_Tree.h

    thats the complete class. i hope thats enought

    ( the code aint prefect. but i'm learning :) )

     

    dont want to be annoing, but... Now i get this warning to

    One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes.

    Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))

    Hide    

    at EnvDTE.CodeFunction.GetStartPoint(vsCMPart Part)
    at Microsoft.VisualC.CppCodeParser.OnMethodPopulateStatements(Object sender, EventArgs e)
    at System.CodeDom.CodeMemberMethod.get_Statements()
    at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
    at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
    at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)
     


  • CougarT

    Sorry you are right... I was to fast in looking at the code.

    I am not sure, but maybe typeid can only be called when the class is fully defined. So what happens if you define VCNode in front of your CTree class
    Its just a guess.

    You only predefined the type. The compiler only knows the name. You are right that the compiler could accept typeid for this type too, because its a global static member. But the compiler has no final knowledge about this type.



  • Compiling bug?