2021年3月23日星期二

C++ gcc compiler strange behavior [duplicate]

Is it Something strange with compiler behavior or I do not know something?

I have some class named A in A.hpp, and it's have a function register_callbacks(), which is public function, it was added by other developer 4 years ago for fixing some crush. Now when I try to delete that function and also its definition from A.cpp I get compile error from another E.cpp file, from where A::register_callbacks() was not called absolutely!. 'undefined reference to `A::register_callbacks()'

Additional information

  1. When I move definition of A::register_callbacks() from A.cpp to A.hpp I got same compile error (The most strange thing for me)
  2. Also I have checked that A::register_callbacks() function was not called outside class methods, by changing its access specifier to private, and class have no friend functions/classes.
  3. I use GCC compiler, version 7.3.0 (GCC).

If you need some more information for answering, please ask!

P. S. Please forgive that I can't show actual code.

https://stackoverflow.com/questions/66772961/c-gcc-compiler-strange-behavior March 24, 2021 at 08:03AM

没有评论:

发表评论