1

I am trying to compile a C++ program using Qt. When I try to compile I get this output:

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

What can I do? Why is this happening? I already tried setting

QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9

(as suggested in this post OpenCv + mac os x + qt creator = strange linking bug?) in my project file but it did not resolve the issue.

Any ideas?

EDIT:

This is what my project file looks like:

TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt

SOURCES += main.cpp \
    a.cpp \
    b.cpp \
    c.cpp

HEADERS += \
    a.h \
    b.h \
    c.h
Community
  • 1
  • 1
user2426316
  • 7,131
  • 20
  • 52
  • 83
  • Are you using QtCreator? Could you please show your qmake project file and share your setup with us? Can you also show how qmake is run on your machine, i.e. with which parameters exactly? – László Papp Apr 24 '14 at 03:54
  • @LaszloPapp I updated my answer. Do you need anything else? – user2426316 Apr 24 '14 at 11:48
  • Yes, please: can you show the qmake command you run to see all the parameters passed? Is this a 64 bit Mac? – László Papp Apr 24 '14 at 11:55
  • It sounds like some external libraries are missing for the link (OpenCV?). Unfortunately the message shown in the tab `Issues` is not very helpful. The raw output from the linker has the information that is needed to fix the problem. You can see that in `Compile Output` in QtCreator. Please post the relevant part with the linker error. – jcm Apr 24 '14 at 12:29
  • Which symbols are missing? Please show the full linker error. – Michael Gaskill Jun 13 '16 at 21:56

1 Answers1

1

I get this error when I have prototyped methods in a header file but not defined them in a source file, or if a function is prototyped but not defined. Make sure all the prototyped functions and class methods have definitions.

  • Make sure all the prototyped functions and class methods have definitions. This is the answer to the question. This error results from declaring a method in the header file but not implementing it in a source file. As a result, you should make sure all the methods you declare in the header have definitions implemented in a source file. Go to the source file for each class in your project and implement all the methods you have declared in the header file. Hopefully that provides sufficient answers to the question without requiring clarification. Implement all declared methods. – user3666782 Jun 12 '16 at 21:35
  • Deleting this post means people will spend hours trying to figure out why they are getting this error needlessly, just as I did. It's a simple fix: go through your project and make sure you have implemented all the methods you declared in your classes, otherwise you will get this error. – user3666782 Jun 13 '16 at 21:54