Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. Newbie: Undeclared Identifier

Newbie: Undeclared Identifier

Scheduled Pinned Locked Moved Managed C++/CLI
c++helptutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jblau
    wrote on last edited by
    #1

    I'm still a rookie, so forgive me if this is simple. I have a form and in the form's .h file i have the form's regular class stuff, but I have also added another class. For example: in my .h file i have something like this: namespace MyNamespace { public __gc class Form1 : public System::Windows::Forms::Form { //then i have all of the regular form stuff //I also have an event handler that is //like this: private: System::Void axTws1_tickPrice(System::Object * sender, AxInterop::TWSLib::_DTwsEvents_tickPriceEvent * e) { //when this event happens I want to create an //instance of another class that I have defined //within this same .h file, which you can see //below. //now when i try to do the following, i get an //error message that states that //"SymbolObject_Constructor" is an undeclared //identifier: SymbolObject_Constructor *tempObject = new SymbolObject_Constructor; }//end of event handler };//end of form class public __gc class SymbolObject_Constructor { public: String *Stock_Ticker; Decimal Bid; Decimal Ask; public: SymbolObject_Constructor() { Stock_Ticker = S""; Bid = 0.0; Ask = 0.0; } };//end of SymbolObject class }//end of namespace in my .cpp file for this form, i have a void method that creates an instance of the SymbolObject class, and I do it the same way as I attempted in the .h file; but in the .cpp file, I don't get the error message. Can anyone see what I am doing wrong? Thanks, Jody Blau

    A 1 Reply Last reply
    0
    • J jblau

      I'm still a rookie, so forgive me if this is simple. I have a form and in the form's .h file i have the form's regular class stuff, but I have also added another class. For example: in my .h file i have something like this: namespace MyNamespace { public __gc class Form1 : public System::Windows::Forms::Form { //then i have all of the regular form stuff //I also have an event handler that is //like this: private: System::Void axTws1_tickPrice(System::Object * sender, AxInterop::TWSLib::_DTwsEvents_tickPriceEvent * e) { //when this event happens I want to create an //instance of another class that I have defined //within this same .h file, which you can see //below. //now when i try to do the following, i get an //error message that states that //"SymbolObject_Constructor" is an undeclared //identifier: SymbolObject_Constructor *tempObject = new SymbolObject_Constructor; }//end of event handler };//end of form class public __gc class SymbolObject_Constructor { public: String *Stock_Ticker; Decimal Bid; Decimal Ask; public: SymbolObject_Constructor() { Stock_Ticker = S""; Bid = 0.0; Ask = 0.0; } };//end of SymbolObject class }//end of namespace in my .cpp file for this form, i have a void method that creates an instance of the SymbolObject class, and I do it the same way as I attempted in the .h file; but in the .cpp file, I don't get the error message. Can anyone see what I am doing wrong? Thanks, Jody Blau

      A Offline
      A Offline
      AnsGe
      wrote on last edited by
      #2

      Hai Nothing wrong in ur code. i also don't know why it happened. But placing your second class before the Form1 calss will solve the problem. ie define all your classes before it uses by Anisg

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups