Results 1 to 5 of 5

Thread: using Carbon api on mac error:Undefined symbols for architecture x86_64

  1. #1
    Join Date
    Apr 2015
    Location
    Beijing,China
    Posts
    6
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Question using Carbon api on mac error:Undefined symbols for architecture x86_64

    Hi

    I'm using Qt5.3(qt-opensource-mac-x64-clang-5.3.1.dmg) on mac os x 10.10.1,xcode6

    I need to use the GetKeys() in carbon in a staticlib,so I did the following:
    1).add header file in .cpp
    Qt Code:
    1. #include <Carbon/Carbon.h>
    To copy to clipboard, switch view to plain text mode 
    2).add framework include in xxx.pro
    Qt Code:
    1. LIBS += -framework Carbon
    To copy to clipboard, switch view to plain text mode 

    mylib compiles ok,but when myapp to link the lib, it throws error:
    Qt Code:
    1. Undefined symbols for architecture x86_64:
    2. "_GetKeys", referenced from:
    3. Platform::get_keyboard_modifiers() in libxxx.a(platform.o)
    4. ld: symbol(s) not found for architecture x86_64
    5. clang: error: linker command failed with exit code 1 (use -v to see invocation)
    To copy to clipboard, switch view to plain text mode 

    I've tryed to add QMAKE_LFLAGS += -L/System/Library/Frameworks/Carbon in xxx.pro,but it didn't work.

    can anyone tell me why,or is there a way in Qt to take the place of Carbon/GetKeys()?
    Thanks
    Last edited by fong; 2nd April 2015 at 04:23.

  2. #2
    Join Date
    Apr 2015
    Location
    Beijing,China
    Posts
    6
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Smile Re: using Carbon api on mac error:Undefined symbols for architecture x86_64

    Solved.

    What I did:
    1).remove "LIBS += -framework Carbon" from xxx.pro(xxx.pro is project file of xxxlib)
    2).add following to myapp.pro(myapp.pro is project file of myapp,who used the xxxlib)
    "LIBS += /System/Library/Frameworks/Carbon.framework/Carbon",
    instead of "LIBS += -framework Carbon"

    So it seems to be a library path problem,but I want to know why and the internal theory.
    Can anyone tell me, or anything talked in Qt's or Apple's documents?

    Thanks

  3. #3
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: using Carbon api on mac error:Undefined symbols for architecture x86_64

    I would have thought the correct way to include the framework would have been:

    LIBS += -F/System/Library/Frameworks/Carbon.framework/Carbon -framework Carbon
    INCLUDEPATH += /System/Library/Frameworks/Carbon.framework/Carbon/Headers/

    Have you tried the above?

  4. #4
    Join Date
    Apr 2015
    Location
    Beijing,China
    Posts
    6
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: using Carbon api on mac error:Undefined symbols for architecture x86_64

    Thank you
    I tried, it also worked.
    Could you please which's the most correct way to include the framework? Any document talked about it?

  5. #5
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: using Carbon api on mac error:Undefined symbols for architecture x86_64

    Quote Originally Posted by fong View Post
    Thank you
    I tried, it also worked.
    Could you please which's the most correct way to include the framework? Any document talked about it?
    The method I posted is the most correct in my opinion. Should work with any framework, etc.

    As far as I know, all of the documentation regarding frameworks in the toolchain are Apple docs (you can google around to see what you can find), since the Xcode toolchain is used for Mac compiling and linking. qmake just provides a way for the developer to pass options to the compile and link steps, but those are not Qt options, they're options for the compiler/linker, etc.

Similar Threads

  1. Replies: 1
    Last Post: 13th January 2014, 21:30
  2. Qt + cocoa : Undefined symbols for architecture x86_64
    By karankumar1609 in forum Qt Programming
    Replies: 0
    Last Post: 20th March 2013, 09:43
  3. no debug symbols in executable (-arch x86_64)
    By bruce2011 in forum Qt Programming
    Replies: 2
    Last Post: 24th August 2011, 15:42
  4. Replies: 0
    Last Post: 16th June 2011, 22:48
  5. qmake: detecting x86_64 architecture?
    By akos.maroy in forum Qt Programming
    Replies: 3
    Last Post: 2nd August 2008, 12:26

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.