Make Error: Undefined symbols for architecture x86_64

后端 未结 1 1342
迷失自我
迷失自我 2020-12-21 12:24

I\'m a pretty novice programmer (as in I only code when I need to), but I mostly work in television. I\'ve been trying to compile a tool I downloaded (bmdtools) for compilat

相关标签:
1条回答
  • 2020-12-21 12:44

    ld: symbol(s) not found for architecture x86_64

    I've always thought this message to be confusing as people tend to focus on the "for architecture x86_64" part of the message. The actual problem here is that a symbol is not found. So, practically, what does this mean?

    If we create a class and declare a function, but don't implement that function's body, the same error will be presented, as the compilation/linker process has been told that a function exists, but can't find it.

    The line below the symbol(s) not found for achitecture x86_4 will usually identify what has not been found.

    Let's look at an example: -

    class PGGui
    {
       public:
           PGGui::PGGui(QObject*)
           {
               DoSomeStuff();
           }
    
        private:
           DoSomeStuff();
    };
    

    This tells us that a class PGGui has declared a function DoStuff, which was referenced from the PGGui constructor: PGGui::PGGui(QObject*), but the function body can't be found.

    As you can see, here, just looking at the first line of the error message doesn't help very much. You need to read the rest of the error to see what is missing, which may be the body of a function, or the inclusion of a library or some other object.

    You'll find software development easier if you begin by trying to understand error messages, rather than simply searching the web for the error and hoping someone else's problem and solution matches your own.

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