Thread: I can not access control of window form from another class in c++

  1. #1
    Registered User
    Join Date
    Dec 2017
    Posts
    1

    I can not access control of window form from another class in c++

    down votefavorite
    i have some forms and one class(queue) in my project and i want to take the information of window form(Add.h) from class(queue) but when I include form(Add.h) in class(queue) and create object of form then it show that identifier "Add" is undefined


    down vote
    favorite
    i have some forms and one class(queue) in my project and i want to take the information of window form(Add.h) from class(queue) but when I include form(Add.h) in class(queue) and create object of form then it show that identifier "Add" is undefined

    Add.h
    Code:
    #pragma once
    Code:
    #include<iostream>
    #include"queue.h"
    using std::cout;
    using std::cin;using std::endl;
    


    Add.cpp
    Code:
    #include"Add.h"


    queue.h
    Code:
    #pragma once
    Code:
    #include<iostream>
    #include"Add.h"
    #include"MMenu.h"
    
    usingnamespace std;
    
    classNodeType{
    public:
      Add info;//error identifier Add is undefiened
      NodeType*link;
    };
    
    classqueue
    {
    public:
       queue();
       void enqueue(Add std);//error identifier Add is undefiened
       void display();
       ~queue();
    };
    
    queue::queue(){}
    
    queue::~queue(){}
    
    voidqueue::display(){}
     voidqueue::enqueue(Add std){}//error identifier Add is undefiened
    


    queue.cpp
    Code:
    #include"queue.h"


    i just started the code and want to get the link between queue class and add form but its show me error "identifier Add is undefined" and if i created another form and include in queue class then also show me error. it seems like when link between class to class is working but class to form is not working.




    Last edited by sanjaykumar2; 12-17-2017 at 11:15 AM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    So you copy/pasted from stackoverflow.

    But you still didn't post the contents of Add.h (where presumably the Add type is implemented).

    Also, it is considered very poor style to have any "using" declarations in header files.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to control the Form components from the other Units
    By valeriy_zf in forum C++ Programming
    Replies: 0
    Last Post: 02-10-2010, 06:33 PM
  2. Access Function in Child Window From Parent Window
    By Welder in forum Windows Programming
    Replies: 3
    Last Post: 05-20-2008, 03:06 AM
  3. Getting the loop control form the user
    By Extropian in forum C Programming
    Replies: 6
    Last Post: 08-11-2005, 09:50 AM
  4. Retrieving the window handle of a window a control resides in
    By -leech- in forum Windows Programming
    Replies: 7
    Last Post: 08-09-2003, 08:55 AM

Tags for this Thread