CLion checks and extern declaration of a C++ class without default constructor -




i have working class, example:

// myclass.h  class myclass { public:      explicit myclass(unsigned char enablepin);      void enable(bool enable);  private:     const unsigned char menabepin; }; 

// myclass.cpp  #include "myclass.h" #include <gpio.h>  myclass::myclass(unsigned char enablepin)      : menabepin(enablepin) { }  void myclass::enable(bool enable) {     gpio_set(menabepin, static_cast<unsigned char>(enable ? 0 : 1)); } 

then have in file extern declaration of 1 instance of class:

// main.h  extern myclass myclass; 

and of course actual definition in 1 .cpp file:

// main.cpp #include "main.h" #include <board.h>  myclass myclass(board::pins::myclass_enable_pin);  int main() {     // ...     myclass.enable(true); } 

this compiles without warnings -wall -wextra , works well.

however seems clion 2017.2.1 not extern declaration , complains about:

enter image description here

and offers me these intention actions:

enter image description here

despite fact recognises declaration-definition shows red-green arrows go definition/declaration shortcut.

i turn off type of checks, belong useful set of type checks, function parameter count mismatch not want turn off.

enter image description here

have run same problem , found neat workaround?





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -