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

前端 未结 5 1703
梦谈多话
梦谈多话 2020-11-29 08:18

I\'m getting the error

Symbol(s) not found for architecture x86_64

Trying to compile a project on Qt

5条回答
  •  甜味超标
    2020-11-29 08:51

    Fortunately I've managed to solve my problem before any answers, so, if anyone is experiencing anything similar, the issue was that it seems you can't split a templated class into a .cpp and a .h file. Putting all declarations of the .cpp file back into the .h solved the issue.

    I still had a leftover problem, though: duplicated symbols (which was the reason I split it). This time, declaring a variable as external in the .h, and redeclaring it without the external keyword in one (and only one) .cpp file solved the issue for good.

提交回复
热议问题