Jump to content


Photo

Are Const Members Supported?

const member const

No replies to this topic

#1 art590

art590

    Newbrie

  • Members
  • 2 posts

Posted 18 June 2015 - 09:21 PM

Hello.

I am wondering if "const int" or "static const int"  class members are supported ? Compiles ok but linker doesn't seem to be able to resolve. I tried with both in class and out of class initialization.  

 

Any help would be much appreciated.

  

...

success
"C:\Program Files\SourceBoost\boostlink_picmicro.exe"  -idx 1  /ld "C:\Program Files\SourceBoost\lib" libc.pic16.lib Debug\member_constant.obj  /t PIC16F84 /d "Debug" /p member_constant
Error: Failed to resolve external:Foo$a
Error: Failed to resolve external:Foo$a
BoostLink Optimizing Linker Version 7.30
Copyright© 2004-2015 Pavel Baranov
Copyright© 2004-2015 David Hobday
failure
Failed to locate output file 'Debug\member_constant.hex'
Done
 
Failed

 

-----------------------------------------------------------------------------------

 
class Foo{
 
static const int a=0x08;
 
public:
 
int xPlus8(int x){ return (a+x); };
 
};
 
 
Foo foo;
 
void main()
{
    int res;
    res = foo.xPlus8(10);
}
 

 

 

 





Reply to this topic



  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users