λ³Έλ¬Έ λ°”λ‘œκ°€κΈ°

πŸ“– Cλž‘ C++

Error ν•΄κ²°: undefined reference to `vtable for XXX'

 

undefined reference to `vtable for XXX'
collect2: error: ld returned 1 exit status

...

 

μ΄λ ‡κ²Œ μ—λŸ¬κ°€ λ‚˜μ˜¨λ‹€λ©΄ μ•„λ§ˆ

vtable for {클래슀 λͺ…} 이런 μ—λŸ¬κ°€ λ‚˜μ˜€κ²Œ 될텐데

 

κ΅¬ν˜„ν•˜λ €λŠ” ν΄λž˜μŠ€μ— ν˜Ήμ‹œ virtual ν•¨μˆ˜λ₯Ό λͺ…μ‹œν•˜κ³ μ„œ

μ†ŒμŠ€νŒŒμΌμ—μ„œ κ΅¬ν˜„μ„ μ•ˆν–ˆλŠ”μ§€ ν™•μΈν•˜λ„λ‘

 

λ˜λŠ”, λΆ€λͺ¨ ν΄λž˜μŠ€μ—μ„œ virtual λͺ…μ‹œν•΄λ‘”κ²Œ μžˆλŠ”λ°

μƒμ†ν•˜λ‹€κ°€ μ‚¬μš© μ•ˆν–ˆλŠ”μ§€ 확인