Undefined reference to symbol, even though the library is linked

后端 未结 1 1132
迷失自我
迷失自我 2021-02-08 12:54

When linking a project I am working on, the linker gives the following errors:

/usr/bin/ld: ../Includes and Libs/lib/libsfml21rca.a(SoundFile.o): undefined refer         


        
相关标签:
1条回答
  • 2021-02-08 13:31

    The linker only runs one pass over the library files. So if you have something in Library A that needs something in Library B, you need to have g++ objects... -llibA -llibB, if you use g++ objects... -llibB -llibA it will fail in the manner you show.

    So, in your case, put the -lsndfile after "../Includes and Libs/lib/libsfml21rca.a".

    (And whose idea was it to put spaces in a the "Includes and Libs" directory - not the best idea I've seen...)

    0 讨论(0)
提交回复
热议问题