Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Error: :-1: error: symbol(s) not found for architecture x86_64; :-1: error: linker command failed with exit code 1 (use -v to see invocation)
Forum Updated to NodeBB v4.3 + New Features

Error: :-1: error: symbol(s) not found for architecture x86_64; :-1: error: linker command failed with exit code 1 (use -v to see invocation)

Scheduled Pinned Locked Moved Solved Installation and Deployment
13 Posts 4 Posters 4.8k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gabry80
    wrote on last edited by
    #1

    Hello, i'm writing some code for school purposes, i create a Qt widget application, when i run the project i get the errors reported in the Title, the platform i'm using is MAC.I have a screenshot of the issue.I guess if anybody can help me.Thank You.!0_1513184974512_Schermata 2017-12-13 alle 17.59.57.png image url)

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Take a look at the compiler panel, what exact symbol is missing ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Gabry80
        wrote on last edited by
        #3

        Sorry but i'm new to Qt and i'm new to C++ also :)

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          No problem with that. But without the information I'm asking, it's going to be difficult to help you.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • G Offline
            G Offline
            Gabry80
            wrote on last edited by
            #5

            This is the compile output(i hope it helps):
            11:54:01: Running steps for project Puntatori1...
            11:54:01: Configuration unchanged, skipping qmake step.
            11:54:01: Starting: "/usr/bin/make"
            /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -stdlib=libc++ -headerpad_max_install_names -arch x86_64 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -mmacosx-version-min=10.10 -Wl,-rpath,@executable_path/Frameworks -Wl,-rpath,/Users/gabrielmometti/Qt/5.9.2/clang_64/lib -o Puntatori1.app/Contents/MacOS/Puntatori1 main.o pointer1.o moc_pointer1.o -F/Users/gabrielmometti/Qt/5.9.2/clang_64/lib -framework QtWidgets -framework QtGui -framework QtCore -framework DiskArbitration -framework IOKit -framework OpenGL -framework AGL
            Undefined symbols for architecture x86_64:
            "sommaPun(int*, int*)", referenced from:
            _main in main.o
            "sommaRif(int&, int&)", referenced from:
            _main in main.o
            "sommaVal(int, int)", referenced from:
            _main in main.o
            ld: symbol(s) not found for architecture x86_64
            clang: error: linker command failed with exit code 1 (use -v to see invocation)
            make: *** [Puntatori1.app/Contents/MacOS/Puntatori1] Error 1
            11:54:01: The process "/usr/bin/make" exited with code 2.
            Error while building/deploying project Puntatori1 (kit: Desktop Qt 5.9.2 clang 64bit)
            When executing step "Make"
            11:54:01: Elapsed time: 00:00.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Where are these methods implemented ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • G Offline
                G Offline
                Gabry80
                wrote on last edited by
                #7

                I've implemented the methods into the main file, and i create an header file in witch i declared the variables.

                K 1 Reply Last reply
                0
                • G Gabry80

                  I've implemented the methods into the main file, and i create an header file in witch i declared the variables.

                  K Offline
                  K Offline
                  karlheinzreichel
                  wrote on last edited by
                  #8

                  @Gabry80 In order to give help it would be necessary to see the code from main (main.cpp / main.h)

                  1 Reply Last reply
                  2
                  • G Offline
                    G Offline
                    Gabry80
                    wrote on last edited by Gabry80
                    #9

                    This is the pointer1.h (Header file)

                    #ifndef POINTER1_H
                    #define POINTER1_H

                    #include <QMainWindow>

                    int sommaVal(int a, int b); //parametri passati per valore
                    int sommaPun(int *a, int *b); //parametri passati per puntatore
                    int sommaRif(int &a, int &b); //parametri passati come indirizzo

                    namespace Ui {
                    class Pointer1;

                    }

                    class Pointer1 : public QMainWindow
                    {
                    Q_OBJECT

                    public:
                    explicit Pointer1(QWidget *parent = 0);
                    ~Pointer1();

                    private:
                    Ui::Pointer1 *ui;
                    };

                    #endif // POINTER1_H

                    And, this is the Main.cpp

                    #include "pointer1.h"
                    #include <QApplication>
                    #include <string>
                    #include <iostream>

                    using namespace std;

                    int main()
                    {
                    int a = 5;
                    int b = 4;
                    char carattere;
                    int rrr = sommaVal(a,b);
                    cout << "Risultato(Val)=" << rrr << endl;
                    cout << "a =" << a << endl;
                    cout << "b =" << b << endl;
                    cout << "-----------" << endl;
                    rrr = sommaPun(&a,&b);
                    cout << "Risultato(Pun)=" << rrr << endl;
                    cout << "a =" << a << endl;
                    cout << "b =" << b << endl;
                    cout << "-----------" << endl;
                    rrr = sommaRif(a,b);
                    cout << "Risultato(Rif)=" << rrr << endl;
                    cout << "a =" << a << endl;
                    cout << "b =" << b << endl;

                    fflush(stdin);
                    scanf("%c", &carattere);
                    
                    int r;
                    r = a+b-1;
                    a = 3;
                    b = 6;
                    
                    return r;
                    

                    /* int s = *a+*b-1;
                    *a = 3;
                    *b = 6;

                    return s;
                    

                    */
                    int t = a+b-1;
                    a = 4;
                    b = 6;

                    return t;
                    

                    }

                    1 Reply Last reply
                    0
                    • mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @Gabry80 said in Error: :-1: error: symbol(s) not found for architecture x86_64; :-1: error: linker command failed with exit code 1 (use -v to see invocation):

                      int sommaVal(int a, int b); //parametri passati per valore
                      int sommaPun(int *a, int *b); //parametri passati per puntatore
                      int sommaRif(int &a, int &b); //parametri passati come indirizzo

                      This is only the defintion.
                      Where are the bodies ?
                      Like
                      int sommaVal(int a, int b) {
                      ..code...
                      }
                      seems not to be in main.cpp ?

                      1 Reply Last reply
                      2
                      • G Offline
                        G Offline
                        Gabry80
                        wrote on last edited by
                        #11

                        I should review the code...

                        mrjjM 1 Reply Last reply
                        0
                        • G Gabry80

                          I should review the code...

                          mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          @Gabry80
                          Yep and find the missing implementations :)

                          1 Reply Last reply
                          1
                          • G Offline
                            G Offline
                            Gabry80
                            wrote on last edited by
                            #13

                            I have reviewed the code and solved the issues,thank you.

                            1 Reply Last reply
                            1

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved