U++ framework
Do not panic. Ask here before giving up.

Home » Community » Newbie corner » static
static [message #56997] Mon, 10 May 2021 22:45 Go to next message
BetoValle is currently offline  BetoValle
Messages: 210
Registered: September 2020
Location: Brasil Valinhos SP
Experienced Member
Hi,
how i work with static class in u++?
below the compiler displays an error message: lld-link: error: undefined symbol: abc::a

  class abc{ // (): lld-link: error: undefined symbol: abc::a
    static String a;
    static String b;
  	
   public:

   String getabc(){
      if(a.IsEqual(""))
      return "abc";   
      else
        return a+b;  
   }
   static void setabc(String v1,String v2){
      a=v1;
      b=v2;
   };
};

CONSOLE_APP_MAIN   
{
   abc::setabc("","");
   
}


Thanks
Re: static [message #56998 is a reply to message #56997] Mon, 10 May 2021 23:34 Go to previous message
BetoValle is currently offline  BetoValle
Messages: 210
Registered: September 2020
Location: Brasil Valinhos SP
Experienced Member

Hi, I forgot to initialize after scope class with

String abc::a="";
String abc::b="";

and also put "static" in String getabc().

now this work!

Thanks
Previous Topic: differences in returns between pointer and reference
Next Topic: Stopping ReadStdIn() function
Goto Forum:
  


Current Time: Wed May 20 19:17:29 GMT+2 2026

Total time taken to generate the page: 0.00436 seconds