C++神奇错误之结构体内变量

undefined reference

Posted by TH911 on November 21, 2024

写了一棵 FHQ Treap,但是报错:

1
2
C:\Users\ADMINI~1\AppData\Local\Temp\ccYwKop1.o	未命名2.cpp:(.rdata$.refptr._ZN5treap4rootE[.refptr._ZN5treap4rootE]+0x0): undefined reference to `treap::root'
D:\1234\collect2.exe	[Error] ld returned 1 exit status

错误原因是 UB(未定义行为)。参见此处