Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. :-1: error: symbol(s) not found for architecture x86_64
Forum Updated to NodeBB v4.3 + New Features

:-1: error: symbol(s) not found for architecture x86_64

Scheduled Pinned Locked Moved Unsolved General and Desktop
42 Posts 6 Posters 13.1k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi and welcome to devnet,

    What version of Qt are you using ?
    On what platform ?
    With which compiler ?

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

    D 1 Reply Last reply
    1
    • SGaistS SGaist

      Hi and welcome to devnet,

      What version of Qt are you using ?
      On what platform ?
      With which compiler ?

      D Offline
      D Offline
      Dhara
      wrote on last edited by
      #3

      @SGaist Hi,

      QT 5.9, Qmake compiler and macOS.

      jsulmJ 1 Reply Last reply
      1
      • D Dhara

        @SGaist Hi,

        QT 5.9, Qmake compiler and macOS.

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #4

        @Dhara Did you add the cpp file containing method definitions of the user class?
        It looks like you're writing unit tests?
        Can you show your pro file?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        D 1 Reply Last reply
        1
        • jsulmJ jsulm

          @Dhara Did you add the cpp file containing method definitions of the user class?
          It looks like you're writing unit tests?
          Can you show your pro file?

          D Offline
          D Offline
          Dhara
          wrote on last edited by
          #5

          @jsulm :

          so i have the main project that has the following contents:

          TEMPLATE = subdirs
          
          SUBDIRS += \
              Test \
              QTConsoleApp
          
          Test.depends = QTConsoleApp
          

          The QTConsoleApp has the following pro file:

          QT += core
          QT -= gui
          
          CONFIG += c++11
          
          TARGET = QTConsoleApp
          CONFIG += console
          CONFIG -= app_bundle
          
          TEMPLATE = lib
          
          SOURCES += main.cpp \
              contact.cpp \
              user.cpp \
              group.cpp
          
          # The following define makes your compiler emit warnings if you use
          # any feature of Qt which as been marked deprecated (the exact warnings
          # depend on your compiler). Please consult the documentation of the
          # deprecated API in order to know how to port your code away from it.
          DEFINES += QT_DEPRECATED_WARNINGS
          
          DEFINES += QTCONSOLEAPP_LIBRARY
          
          # You can also make your code fail to compile if you use deprecated APIs.
          # In order to do so, uncomment the following line.
          # You can also select to disable deprecated APIs only up to a certain version of Qt.
          #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
          
          HEADERS += \
              contact.h \
              user.h \
              group.h
          
          

          The last one has the following pro content:

          
          #-------------------------------------------------
          #
          # Project created by QtCreator 2017-06-18T23:06:36
          #
          #-------------------------------------------------
          
          QT       += testlib
          
          QT       -= gui
          
          TARGET = test_user
          CONFIG   += console
          CONFIG   -= app_bundle
          
          TEMPLATE = app
          
          # The following define makes your compiler emit warnings if you use
          # any feature of Qt which as been marked as deprecated (the exact warnings
          # depend on your compiler). Please consult the documentation of the
          # deprecated API in order to know how to port your code away from it.
          DEFINES += QT_DEPRECATED_WARNINGS
          
          # You can also make your code fail to compile if you use deprecated APIs.
          # In order to do so, uncomment the following line.
          # You can also select to disable deprecated APIs only up to a certain version of Qt.
          #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
          
          
          SOURCES += \
                  test_user.cc \ 
              test_group.cc
          
          DEFINES += SRCDIR=\\\"$$PWD/\\\"
          
          INCLUDEPATH += ../QTConsoleApp
          
          stdlib -=libc++
          stdlib -=libstdc++
          
          

          Thanks

          jsulmJ 1 Reply Last reply
          0
          • D Dhara

            @jsulm :

            so i have the main project that has the following contents:

            TEMPLATE = subdirs
            
            SUBDIRS += \
                Test \
                QTConsoleApp
            
            Test.depends = QTConsoleApp
            

            The QTConsoleApp has the following pro file:

            QT += core
            QT -= gui
            
            CONFIG += c++11
            
            TARGET = QTConsoleApp
            CONFIG += console
            CONFIG -= app_bundle
            
            TEMPLATE = lib
            
            SOURCES += main.cpp \
                contact.cpp \
                user.cpp \
                group.cpp
            
            # The following define makes your compiler emit warnings if you use
            # any feature of Qt which as been marked deprecated (the exact warnings
            # depend on your compiler). Please consult the documentation of the
            # deprecated API in order to know how to port your code away from it.
            DEFINES += QT_DEPRECATED_WARNINGS
            
            DEFINES += QTCONSOLEAPP_LIBRARY
            
            # You can also make your code fail to compile if you use deprecated APIs.
            # In order to do so, uncomment the following line.
            # You can also select to disable deprecated APIs only up to a certain version of Qt.
            #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
            
            HEADERS += \
                contact.h \
                user.h \
                group.h
            
            

            The last one has the following pro content:

            
            #-------------------------------------------------
            #
            # Project created by QtCreator 2017-06-18T23:06:36
            #
            #-------------------------------------------------
            
            QT       += testlib
            
            QT       -= gui
            
            TARGET = test_user
            CONFIG   += console
            CONFIG   -= app_bundle
            
            TEMPLATE = app
            
            # The following define makes your compiler emit warnings if you use
            # any feature of Qt which as been marked as deprecated (the exact warnings
            # depend on your compiler). Please consult the documentation of the
            # deprecated API in order to know how to port your code away from it.
            DEFINES += QT_DEPRECATED_WARNINGS
            
            # You can also make your code fail to compile if you use deprecated APIs.
            # In order to do so, uncomment the following line.
            # You can also select to disable deprecated APIs only up to a certain version of Qt.
            #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
            
            
            SOURCES += \
                    test_user.cc \ 
                test_group.cc
            
            DEFINES += SRCDIR=\\\"$$PWD/\\\"
            
            INCLUDEPATH += ../QTConsoleApp
            
            stdlib -=libc++
            stdlib -=libstdc++
            
            

            Thanks

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #6

            @Dhara said in :-1: error: symbol(s) not found for architecture x86_64:

            TEMPLATE = lib

            why is you console app a lib?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            D 1 Reply Last reply
            0
            • jsulmJ jsulm

              @Dhara said in :-1: error: symbol(s) not found for architecture x86_64:

              TEMPLATE = lib

              why is you console app a lib?

              D Offline
              D Offline
              Dhara
              wrote on last edited by
              #7

              @jsulm : i want to access user.h in the Test project, and to include it into the path i thought the QTConsoleApp should be a lib that is why. Should i change it to app? And check?

              jsulmJ 1 Reply Last reply
              0
              • D Dhara

                @jsulm : i want to access user.h in the Test project, and to include it into the path i thought the QTConsoleApp should be a lib that is why. Should i change it to app? And check?

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by jsulm
                #8

                @Dhara The question is actually: should it be an executable or a lib? So, do you want to execute QTConsoleApp? Because you cannot execute a library.
                It doesn't have to be a lib to be able to access its source file from Test project. You can just add needed source files in the pro file of your Test project.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                D 1 Reply Last reply
                2
                • jsulmJ jsulm

                  @Dhara The question is actually: should it be an executable or a lib? So, do you want to execute QTConsoleApp? Because you cannot execute a library.
                  It doesn't have to be a lib to be able to access its source file from Test project. You can just add needed source files in the pro file of your Test project.

                  D Offline
                  D Offline
                  Dhara
                  wrote on last edited by
                  #9

                  @jsulm : i actually want to run the test project and see if the test cases pass or fail. I however changed it to app too :D.. but i get the same error . I am unfortunately knew to C++ and qT too so i wasn't even aware what i should pick so i think either one should be ok : exe types or even lib.

                  jsulmJ 1 Reply Last reply
                  0
                  • D Dhara

                    @jsulm : i actually want to run the test project and see if the test cases pass or fail. I however changed it to app too :D.. but i get the same error . I am unfortunately knew to C++ and qT too so i wasn't even aware what i should pick so i think either one should be ok : exe types or even lib.

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    @Dhara Just add the source files you want to test to your Test project (in the pro file).

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    D 1 Reply Last reply
                    2
                    • jsulmJ jsulm

                      @Dhara Just add the source files you want to test to your Test project (in the pro file).

                      D Offline
                      D Offline
                      Dhara
                      wrote on last edited by
                      #11

                      @jsulm okay. I will do that and get back to you .

                      D 1 Reply Last reply
                      1
                      • D Dhara

                        @jsulm okay. I will do that and get back to you .

                        D Offline
                        D Offline
                        Dhara
                        wrote on last edited by
                        #12

                        @jsulm : I updated the code and i get the same kind of error but i think its reduced a little bit:

                        Undefined symbols for architecture x86_64:
                          "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [11]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [11], char const*, char const*, char const*, int)", referenced from:
                              TestGroup::copyOfGroupSharesName1() in test_group.o
                              TestGroup::contactFromGroupSharesName1() in test_group.o
                              TestGroup::contactFromGroupSharesName2() in test_group.o
                          "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [1]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [1], char const*, char const*, char const*, int)", referenced from:
                              TestUser::nullUserUriIsEmpty() in test_user.o
                              TestUser::nullUserNameIsEmpty() in test_user.o
                              TestUser::initialNameForNamelessUserIsEmpty() in test_user.o
                              TestUser::cannotSetNullUserName() in test_user.o
                              TestGroup::nullGroupUriIsEmpty() in test_group.o
                              TestGroup::nullGroupNameIsEmpty() in test_group.o
                              TestGroup::initialNameForNamelessGroupIsEmpty() in test_group.o
                              ...
                        

                        i have not pasted the other errors, but are of similar kinds.

                        jsulmJ 1 Reply Last reply
                        0
                        • D Dhara

                          @jsulm : I updated the code and i get the same kind of error but i think its reduced a little bit:

                          Undefined symbols for architecture x86_64:
                            "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [11]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [11], char const*, char const*, char const*, int)", referenced from:
                                TestGroup::copyOfGroupSharesName1() in test_group.o
                                TestGroup::contactFromGroupSharesName1() in test_group.o
                                TestGroup::contactFromGroupSharesName2() in test_group.o
                            "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [1]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [1], char const*, char const*, char const*, int)", referenced from:
                                TestUser::nullUserUriIsEmpty() in test_user.o
                                TestUser::nullUserNameIsEmpty() in test_user.o
                                TestUser::initialNameForNamelessUserIsEmpty() in test_user.o
                                TestUser::cannotSetNullUserName() in test_user.o
                                TestGroup::nullGroupUriIsEmpty() in test_group.o
                                TestGroup::nullGroupNameIsEmpty() in test_group.o
                                TestGroup::initialNameForNamelessGroupIsEmpty() in test_group.o
                                ...
                          

                          i have not pasted the other errors, but are of similar kinds.

                          jsulmJ Offline
                          jsulmJ Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on last edited by jsulm
                          #13

                          @Dhara What exactly did you update? It looks like QTest::qCompare is not found. Do you have QT += testlib in the pro file in your Test project?

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          D 2 Replies Last reply
                          0
                          • jsulmJ jsulm

                            @Dhara What exactly did you update? It looks like QTest::qCompare is not found. Do you have QT += testlib in the pro file in your Test project?

                            D Offline
                            D Offline
                            Dhara
                            wrote on last edited by
                            #14

                            @jsulm I moved the files from qTConsoleApp to the Test project. So now i just have 2 pro files. The main one and the Test Project one's.

                            main pro:

                            TEMPLATE = subdirs
                            
                            SUBDIRS += \
                                Test
                            
                            

                            Test project's pro:

                            #-------------------------------------------------
                            #
                            # Project created by QtCreator 2017-06-18T23:06:36
                            #
                            #-------------------------------------------------
                            
                            QT       += testlib
                            
                            QT       -= gui
                            
                            TARGET = test_user
                            CONFIG   += console
                            CONFIG   -= app_bundle
                            
                            TEMPLATE = app
                            
                            # The following define makes your compiler emit warnings if you use
                            # any feature of Qt which as been marked as deprecated (the exact warnings
                            # depend on your compiler). Please consult the documentation of the
                            # deprecated API in order to know how to port your code away from it.
                            DEFINES += QT_DEPRECATED_WARNINGS
                            
                            # You can also make your code fail to compile if you use deprecated APIs.
                            # In order to do so, uncomment the following line.
                            # You can also select to disable deprecated APIs only up to a certain version of Qt.
                            #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                            
                            
                            SOURCES += \
                                    test_user.cc \ 
                                test_group.cc \
                                contact.cpp \
                                user.cpp \
                                group.cpp
                            
                            DEFINES += SRCDIR=\\\"$$PWD/\\\"
                            
                            INCLUDEPATH += ../QTConsoleApp
                            
                            stdlib -=libc++
                            stdlib -=libstdc++
                            
                            HEADERS += \
                                contact.h \
                                user.h \
                                group.h
                            
                            

                            Yes,, it does have the line you wrote.

                            jsulmJ 1 Reply Last reply
                            0
                            • jsulmJ jsulm

                              @Dhara What exactly did you update? It looks like QTest::qCompare is not found. Do you have QT += testlib in the pro file in your Test project?

                              D Offline
                              D Offline
                              Dhara
                              wrote on last edited by
                              #15

                              @jsulm : also, here is the whole error message

                              Undefined symbols for architecture x86_64:
                                "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [11]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [11], char const*, char const*, char const*, int)", referenced from:
                                    TestGroup::copyOfGroupSharesName1() in test_group.o
                                    TestGroup::contactFromGroupSharesName1() in test_group.o
                                    TestGroup::contactFromGroupSharesName2() in test_group.o
                                "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [1]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [1], char const*, char const*, char const*, int)", referenced from:
                                    TestUser::nullUserUriIsEmpty() in test_user.o
                                    TestUser::nullUserNameIsEmpty() in test_user.o
                                    TestUser::initialNameForNamelessUserIsEmpty() in test_user.o
                                    TestUser::cannotSetNullUserName() in test_user.o
                                    TestGroup::nullGroupUriIsEmpty() in test_group.o
                                    TestGroup::nullGroupNameIsEmpty() in test_group.o
                                    TestGroup::initialNameForNamelessGroupIsEmpty() in test_group.o
                                    ...
                                "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [20]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [20], char const*, char const*, char const*, int)", referenced from:
                                    TestUser::canInitUriWithCtorForNamedUser() in test_user.o
                                "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [22]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [22], char const*, char const*, char const*, int)", referenced from:
                                    TestUser::canInitUriWithCtorForeNamelessUser() in test_user.o
                                    TestUser::copyOfUserHasSameUri() in test_user.o
                                    TestUser::contactFromUserHasSameUri() in test_user.o
                                "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [23]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [23], char const*, char const*, char const*, int)", referenced from:
                                    TestGroup::canInitUriWithCtorForeNamelessGroup() in test_group.o
                                    TestGroup::canInitUriWithCtorForNamedGroup() in test_group.o
                                    TestGroup::copyOfGroupHasSameUri() in test_group.o
                                    TestGroup::contactFromGroupHasSameUri() in test_group.o
                                "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [4]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [4], char const*, char const*, char const*, int)", referenced from:
                                    TestUser::canInitNameWithCtor() in test_user.o
                                    TestUser::copyOfUserHasSameName() in test_user.o
                                    TestUser::contactFromUserHasSameName() in test_user.o
                                "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [6]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [6], char const*, char const*, char const*, int)", referenced from:
                                    TestUser::canChangeUserNameIfWasUnset() in test_user.o
                                "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [7]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [7], char const*, char const*, char const*, int)", referenced from:
                                    TestUser::canChangeUserNameIfWasSet() in test_user.o
                                    TestUser::copyOfUserSharesName1() in test_user.o
                                    TestUser::copyOfUserSharesName2() in test_user.o
                                    TestUser::contactFromUserSharesName1() in test_user.o
                                    TestUser::contactFromUserSharesName2() in test_user.o
                                    TestGroup::canInitNameWithCtor() in test_group.o
                                    TestGroup::canChangeGroupNameIfWasUnset() in test_group.o
                                    ...
                                "contact::name()", referenced from:
                                    TestUser::nullUserNameIsEmpty() in test_user.o
                                    TestUser::canInitNameWithCtor() in test_user.o
                                    TestUser::initialNameForNamelessUserIsEmpty() in test_user.o
                                    TestUser::cannotSetNullUserName() in test_user.o
                                    TestUser::canChangeUserNameIfWasUnset() in test_user.o
                                    TestUser::canChangeUserNameIfWasSet() in test_user.o
                                    TestUser::copyOfUserHasSameName() in test_user.o
                                    ...
                                "contact::setUri(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
                                    user::user(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in test_user.o
                                    user::user(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in test_user.o
                                    user::user(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in test_group.o
                                    user::user(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in test_group.o
                                "contact::setName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
                                    TestUser::cannotSetNullUserName() in test_user.o
                                    TestUser::canChangeUserNameIfWasUnset() in test_user.o
                                    TestUser::canChangeUserNameIfWasSet() in test_user.o
                                    TestUser::copyOfUserSharesName1() in test_user.o
                                    TestUser::copyOfUserSharesName2() in test_user.o
                                    TestUser::contactFromUserSharesName1() in test_user.o
                                    TestUser::contactFromUserSharesName2() in test_user.o
                                    ...
                              
                              1 Reply Last reply
                              0
                              • D Dhara

                                @jsulm I moved the files from qTConsoleApp to the Test project. So now i just have 2 pro files. The main one and the Test Project one's.

                                main pro:

                                TEMPLATE = subdirs
                                
                                SUBDIRS += \
                                    Test
                                
                                

                                Test project's pro:

                                #-------------------------------------------------
                                #
                                # Project created by QtCreator 2017-06-18T23:06:36
                                #
                                #-------------------------------------------------
                                
                                QT       += testlib
                                
                                QT       -= gui
                                
                                TARGET = test_user
                                CONFIG   += console
                                CONFIG   -= app_bundle
                                
                                TEMPLATE = app
                                
                                # The following define makes your compiler emit warnings if you use
                                # any feature of Qt which as been marked as deprecated (the exact warnings
                                # depend on your compiler). Please consult the documentation of the
                                # deprecated API in order to know how to port your code away from it.
                                DEFINES += QT_DEPRECATED_WARNINGS
                                
                                # You can also make your code fail to compile if you use deprecated APIs.
                                # In order to do so, uncomment the following line.
                                # You can also select to disable deprecated APIs only up to a certain version of Qt.
                                #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                                
                                
                                SOURCES += \
                                        test_user.cc \ 
                                    test_group.cc \
                                    contact.cpp \
                                    user.cpp \
                                    group.cpp
                                
                                DEFINES += SRCDIR=\\\"$$PWD/\\\"
                                
                                INCLUDEPATH += ../QTConsoleApp
                                
                                stdlib -=libc++
                                stdlib -=libstdc++
                                
                                HEADERS += \
                                    contact.h \
                                    user.h \
                                    group.h
                                
                                

                                Yes,, it does have the line you wrote.

                                jsulmJ Offline
                                jsulmJ Offline
                                jsulm
                                Lifetime Qt Champion
                                wrote on last edited by
                                #16

                                @Dhara said in :-1: error: symbol(s) not found for architecture x86_64:

                                I moved the files from qTConsoleApp to the Test project

                                Why?! They belong to qTConsoleApp, not to the test project! Don't move them, just reference them in Test pro file:

                                SOURCES += \
                                        test_user.cc \ 
                                    test_group.cc \
                                    ..\QTConsoleApp\contact.cpp \
                                    ..\QTConsoleApp\user.cpp \
                                    ..\QTConsoleApp\group.cpp
                                

                                https://forum.qt.io/topic/113070/qt-code-of-conduct

                                D 2 Replies Last reply
                                0
                                • jsulmJ jsulm

                                  @Dhara said in :-1: error: symbol(s) not found for architecture x86_64:

                                  I moved the files from qTConsoleApp to the Test project

                                  Why?! They belong to qTConsoleApp, not to the test project! Don't move them, just reference them in Test pro file:

                                  SOURCES += \
                                          test_user.cc \ 
                                      test_group.cc \
                                      ..\QTConsoleApp\contact.cpp \
                                      ..\QTConsoleApp\user.cpp \
                                      ..\QTConsoleApp\group.cpp
                                  
                                  D Offline
                                  D Offline
                                  Dhara
                                  wrote on last edited by
                                  #17

                                  @jsulm okay . sorry about it. i will revert it back.

                                  1 Reply Last reply
                                  1
                                  • jsulmJ jsulm

                                    @Dhara said in :-1: error: symbol(s) not found for architecture x86_64:

                                    I moved the files from qTConsoleApp to the Test project

                                    Why?! They belong to qTConsoleApp, not to the test project! Don't move them, just reference them in Test pro file:

                                    SOURCES += \
                                            test_user.cc \ 
                                        test_group.cc \
                                        ..\QTConsoleApp\contact.cpp \
                                        ..\QTConsoleApp\user.cpp \
                                        ..\QTConsoleApp\group.cpp
                                    
                                    D Offline
                                    D Offline
                                    Dhara
                                    wrote on last edited by
                                    #18

                                    @jsulm , i have got the files back and added the sources too, the error message i get is :

                                    Undefined symbols for architecture x86_64:
                                      "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [11]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [11], char const*, char const*, char const*, int)", referenced from:
                                          TestGroup::copyOfGroupSharesName1() in test_group.o
                                          TestGroup::contactFromGroupSharesName1() in test_group.o
                                          TestGroup::contactFromGroupSharesName2() in test_group.o
                                      "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [1]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [1], char const*, char const*, char const*, int)", referenced from:
                                          TestUser::nullUserUriIsEmpty() in test_user.o
                                          TestUser::nullUserNameIsEmpty() in test_user.o
                                          TestUser::initialNameForNamelessUserIsEmpty() in test_user.o
                                          TestUser::cannotSetNullUserName() in test_user.o
                                          TestGroup::nullGroupUriIsEmpty() in test_group.o
                                          TestGroup::nullGroupNameIsEmpty() in test_group.o
                                          TestGroup::initialNameForNamelessGroupIsEmpty() in test_group.o
                                          ...
                                      "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [20]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [20], char const*, char const*, char const*, int)", referenced from:
                                          TestUser::canInitUriWithCtorForNamedUser() in test_user.o
                                      "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [22]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [22], char const*, char const*, char const*, int)", referenced from:
                                          TestUser::canInitUriWithCtorForeNamelessUser() in test_user.o
                                          TestUser::copyOfUserHasSameUri() in test_user.o
                                          TestUser::contactFromUserHasSameUri() in test_user.o
                                      "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [23]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [23], char const*, char const*, char const*, int)", referenced from:
                                          TestGroup::canInitUriWithCtorForeNamelessGroup() in test_group.o
                                          TestGroup::canInitUriWithCtorForNamedGroup() in test_group.o
                                          TestGroup::copyOfGroupHasSameUri() in test_group.o
                                          TestGroup::contactFromGroupHasSameUri() in test_group.o
                                      "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [4]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [4], char const*, char const*, char const*, int)", referenced from:
                                          TestUser::canInitNameWithCtor() in test_user.o
                                          TestUser::copyOfUserHasSameName() in test_user.o
                                          TestUser::contactFromUserHasSameName() in test_user.o
                                      "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [6]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [6], char const*, char const*, char const*, int)", referenced from:
                                          TestUser::canChangeUserNameIfWasUnset() in test_user.o
                                      "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [7]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [7], char const*, char const*, char const*, int)", referenced from:
                                          TestUser::canChangeUserNameIfWasSet() in test_user.o
                                          TestUser::copyOfUserSharesName1() in test_user.o
                                          TestUser::copyOfUserSharesName2() in test_user.o
                                          TestUser::contactFromUserSharesName1() in test_user.o
                                          TestUser::contactFromUserSharesName2() in test_user.o
                                          TestGroup::canInitNameWithCtor() in test_group.o
                                          TestGroup::canChangeGroupNameIfWasUnset() in test_group.o
                                          ...
                                      "contact::name()", referenced from:
                                          TestUser::nullUserNameIsEmpty() in test_user.o
                                          TestUser::canInitNameWithCtor() in test_user.o
                                          TestUser::initialNameForNamelessUserIsEmpty() in test_user.o
                                          TestUser::cannotSetNullUserName() in test_user.o
                                          TestUser::canChangeUserNameIfWasUnset() in test_user.o
                                          TestUser::canChangeUserNameIfWasSet() in test_user.o
                                          TestUser::copyOfUserHasSameName() in test_user.o
                                          ...
                                      "contact::setUri(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
                                          user::user(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in test_user.o
                                          user::user(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in test_user.o
                                          user::user(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in test_group.o
                                          user::user(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in test_group.o
                                      "contact::setName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
                                          TestUser::cannotSetNullUserName() in test_user.o
                                          TestUser::canChangeUserNameIfWasUnset() in test_user.o
                                          TestUser::canChangeUserNameIfWasSet() in test_user.o
                                          TestUser::copyOfUserSharesName1() in test_user.o
                                          TestUser::copyOfUserSharesName2() in test_user.o
                                          TestUser::contactFromUserSharesName1() in test_user.o
                                          TestUser::contactFromUserSharesName2() in test_user.o
                                          ...
                                    
                                    jsulmJ 1 Reply Last reply
                                    0
                                    • D Dhara

                                      @jsulm , i have got the files back and added the sources too, the error message i get is :

                                      Undefined symbols for architecture x86_64:
                                        "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [11]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [11], char const*, char const*, char const*, int)", referenced from:
                                            TestGroup::copyOfGroupSharesName1() in test_group.o
                                            TestGroup::contactFromGroupSharesName1() in test_group.o
                                            TestGroup::contactFromGroupSharesName2() in test_group.o
                                        "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [1]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [1], char const*, char const*, char const*, int)", referenced from:
                                            TestUser::nullUserUriIsEmpty() in test_user.o
                                            TestUser::nullUserNameIsEmpty() in test_user.o
                                            TestUser::initialNameForNamelessUserIsEmpty() in test_user.o
                                            TestUser::cannotSetNullUserName() in test_user.o
                                            TestGroup::nullGroupUriIsEmpty() in test_group.o
                                            TestGroup::nullGroupNameIsEmpty() in test_group.o
                                            TestGroup::initialNameForNamelessGroupIsEmpty() in test_group.o
                                            ...
                                        "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [20]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [20], char const*, char const*, char const*, int)", referenced from:
                                            TestUser::canInitUriWithCtorForNamedUser() in test_user.o
                                        "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [22]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [22], char const*, char const*, char const*, int)", referenced from:
                                            TestUser::canInitUriWithCtorForeNamelessUser() in test_user.o
                                            TestUser::copyOfUserHasSameUri() in test_user.o
                                            TestUser::contactFromUserHasSameUri() in test_user.o
                                        "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [23]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [23], char const*, char const*, char const*, int)", referenced from:
                                            TestGroup::canInitUriWithCtorForeNamelessGroup() in test_group.o
                                            TestGroup::canInitUriWithCtorForNamedGroup() in test_group.o
                                            TestGroup::copyOfGroupHasSameUri() in test_group.o
                                            TestGroup::contactFromGroupHasSameUri() in test_group.o
                                        "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [4]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [4], char const*, char const*, char const*, int)", referenced from:
                                            TestUser::canInitNameWithCtor() in test_user.o
                                            TestUser::copyOfUserHasSameName() in test_user.o
                                            TestUser::contactFromUserHasSameName() in test_user.o
                                        "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [6]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [6], char const*, char const*, char const*, int)", referenced from:
                                            TestUser::canChangeUserNameIfWasUnset() in test_user.o
                                        "bool QTest::qCompare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char [7]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [7], char const*, char const*, char const*, int)", referenced from:
                                            TestUser::canChangeUserNameIfWasSet() in test_user.o
                                            TestUser::copyOfUserSharesName1() in test_user.o
                                            TestUser::copyOfUserSharesName2() in test_user.o
                                            TestUser::contactFromUserSharesName1() in test_user.o
                                            TestUser::contactFromUserSharesName2() in test_user.o
                                            TestGroup::canInitNameWithCtor() in test_group.o
                                            TestGroup::canChangeGroupNameIfWasUnset() in test_group.o
                                            ...
                                        "contact::name()", referenced from:
                                            TestUser::nullUserNameIsEmpty() in test_user.o
                                            TestUser::canInitNameWithCtor() in test_user.o
                                            TestUser::initialNameForNamelessUserIsEmpty() in test_user.o
                                            TestUser::cannotSetNullUserName() in test_user.o
                                            TestUser::canChangeUserNameIfWasUnset() in test_user.o
                                            TestUser::canChangeUserNameIfWasSet() in test_user.o
                                            TestUser::copyOfUserHasSameName() in test_user.o
                                            ...
                                        "contact::setUri(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
                                            user::user(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in test_user.o
                                            user::user(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in test_user.o
                                            user::user(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in test_group.o
                                            user::user(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in test_group.o
                                        "contact::setName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
                                            TestUser::cannotSetNullUserName() in test_user.o
                                            TestUser::canChangeUserNameIfWasUnset() in test_user.o
                                            TestUser::canChangeUserNameIfWasSet() in test_user.o
                                            TestUser::copyOfUserSharesName1() in test_user.o
                                            TestUser::copyOfUserSharesName2() in test_user.o
                                            TestUser::contactFromUserSharesName1() in test_user.o
                                            TestUser::contactFromUserSharesName2() in test_user.o
                                            ...
                                      
                                      jsulmJ Offline
                                      jsulmJ Offline
                                      jsulm
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #19

                                      @Dhara Can you show how you're using QCOMPARE?

                                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                                      D 1 Reply Last reply
                                      1
                                      • jsulmJ jsulm

                                        @Dhara Can you show how you're using QCOMPARE?

                                        D Offline
                                        D Offline
                                        Dhara
                                        wrote on last edited by
                                        #20

                                        @jsulm :

                                        void nullUserUriIsEmpty() {
                                                user u;
                                                QCOMPARE(u.uri(), "");
                                            }
                                        

                                        The method u.uri() is as under:

                                        string contact::uri() { return *contactUri; } // inside the cpp file
                                        
                                        string uri(); // inside the h file
                                        
                                        
                                        jsulmJ 1 Reply Last reply
                                        0
                                        • D Dhara

                                          @jsulm :

                                          void nullUserUriIsEmpty() {
                                                  user u;
                                                  QCOMPARE(u.uri(), "");
                                              }
                                          

                                          The method u.uri() is as under:

                                          string contact::uri() { return *contactUri; } // inside the cpp file
                                          
                                          string uri(); // inside the h file
                                          
                                          
                                          jsulmJ Offline
                                          jsulmJ Offline
                                          jsulm
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #21

                                          @Dhara Are there any other errors like library not found?

                                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                                          D 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