“Symbol(s) not found for architecture x86_64” on QtCreator project

In my opinion, the error message that Qt Creator displays is quite misleading until you understand it, but does not prevent splitting the template class into a header and implementation file. If you think about the message:

Symbol(s) not found for architecture x86_64

the problem, I originally thought when I saw this, is that it states this error on its own in the Issues output and can lead the user into thinking that the problem is due to the architecture. Actually, all its saying is that there’s a defined symbol (often function) whose matching implementation wasn’t found.

If you change from Issues to the Compile Output window and scroll up, you’ll be able to see exactly what symbols can’t be found; mine’s displayed in red. It’s just annoying that the detail of the missing symbol(s) doesn’t show up in the Issues view.

It’s easy to replicate this error by just adding a function definition into a header and without implementing the function, call it from the .cpp file. You’ll then see something like this in the Issues window

symbol not found

Switching to the Compile Output view and scrolling up displays this: –

enter image description here

So now we see that tthe actual problem is that the function DoSomeStuff in the class called PGGui is being called from the constructor PGGui::PGGui, but the body of DoSomeStuff is missing, as its symbol is not found.

Leave a Comment