Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » static
static [message #56997] Mon, 10 May 2021 22:45 Go to next message
BetoValle is currently offline  BetoValle
Messages: 203
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: 203
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: Sun Jun 23 09:18:23 CEST 2024

Total time taken to generate the page: 0.01406 seconds