DEV Community

mdh81
mdh81

Posted on

Answer: C++ inlining class methods causes undefined reference

7.1.2/4 of the Standard:

An inline function shall be defined in every translation unit in which it is used...

You use TestMethod in main.cpp, but it's not defined there.

... If a function with external linkage is declared inline in one translation unit, it shall be declared inline in all…

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay