Objective-C Examples
  • IKE
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    IKE
    Posts: 146 from 2009/11/7
    From: Southern CA
    Hello All,

    When I try to compile the examples in the SDK 3.14 with the provide make file, I get this error: " undefined reference to `__objc_class_name_OBApplication' ".

    It seems to exist in a couple of the libs when I search for it, i.e. (libmui.framework.a and libmui_debug.framework.a). I know these examples compiled under SDK 3.12. Any idea what the issue is?

    Also, are there any other examples of using MUI with Objective-C available?

    Thanks in advance,
    IKE
    IKE

    MacMini G4 1.5Ghz/PowerBook G4 1.67Ghz/PowerMac G5 2.0Ghz DP 7,2 Radeon 9650/256MB

    Join the conversation @ r/morphos
  • »05.12.20 - 01:41
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    polluks
    Posts: 779 from 2007/10/23
    From: Gelsenkirchen,...
    You may write a bug report if jacadcaps doesn't answer soon.
    Other examples? I'm pretty sure: no (this is proved by noone compiled the examples again ;-)).
    Pegasos II G4: MorphOS 3.9, Zalman M220W · iMac G5 12,1 17", MorphOS 3.18
    Power Mac G3: OSX 10.3 · PowerBook 5,8: OSX 10.5, MorphOS 3.18
  • »05.12.20 - 16:11
    Profile
  • MorphOS Developer
    jacadcaps
    Posts: 2971 from 2003/3/5
    From: Canada
    OBApplication sits in libob.framework.a. It's in gg:ppc-morphos/lib in the SDK. Sorry, I forgot to update the Frameworks/Examples/Makefile. Just edit -lob_debug.framework -lmui_debug.framework to -lob.framework -lmui.framework respectively.

    Did you check if the Flow Studio project compiles OK? That's the CustomClass2.xprj file - open that from the Project menu in Flow.
  • »05.12.20 - 16:35
    Profile Visit Website
  • MorphOS Developer
    jacadcaps
    Posts: 2971 from 2003/3/5
    From: Canada
    Btw do you have any specific examples in mind? I've written tons of ObjC-MUI code and would be happy to provide examples, but just I don't believe in the value of just opensourcing bigger projects since it'd be hard to learn from those.

    I'll try to clean up Zoom enough to put it on github and include in future SDK releases. It's quite small, but also a good illustration of ObjectiveC 2.0 w/ ARC usage.
  • »05.12.20 - 16:39
    Profile Visit Website
  • IKE
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    IKE
    Posts: 146 from 2009/11/7
    From: Southern CA
    Quote:

    jacadcaps wrote:
    OBApplication sits in libob.framework.a. It's in gg:ppc-morphos/lib in the SDK. Sorry, I forgot to update the Frameworks/Examples/Makefile. Just edit -lob_debug.framework -lmui_debug.framework to -lob.framework -lmui.framework respectively.

    Did you check if the Flow Studio project compiles OK? That's the CustomClass2.xprj file - open that from the Project menu in Flow.


    Thanks for the response. I tried that, it creates the first three .mo files and then fails here on the .db file:

    Work:Development/Frameworks/Examples> make
    ppc-morphos-gcc-5 -Wall -DDEBUG=1 -Og -noixemul -I/SDK/Frameworks/include -fconstant-string-class=OBConstantString -fobjc-exceptions -g -std=gnu99 -Wl,--traditional-format -c CSVViewer.m -o CSVViewer.mo
    ppc-morphos-gcc-5 -Wall -DDEBUG=1 -Og -noixemul -I/SDK/Frameworks/include -fconstant-string-class=OBConstantString -fobjc-exceptions -g -std=gnu99 -Wl,--traditional-format -c CSVList.m -o CSVList.mo
    ppc-morphos-gcc-5 -Wall -DDEBUG=1 -Og -noixemul -I/SDK/Frameworks/include -fconstant-string-class=OBConstantString -fobjc-exceptions -g -std=gnu99 -Wl,--traditional-format -c CSVLoadSave.m -o CSVLoadSave.mo
    ppc-morphos-gcc-5 -Wall -DDEBUG=1 -Og -noixemul -I/SDK/Frameworks/include -fconstant-string-class=OBConstantString -fobjc-exceptions -g -std=gnu99 -Wl,--traditional-format CSVViewer.mo CSVList.mo CSVLoadSave.mo -lob.framework -lmui.framework -lobjc -ldebug -noixemul -lm -lmath -o CSVViewer.db
    /Work/Development/gg/bin/../lib/gcc-lib/ppc-morphos/5.5.0/../../../../ppc-morphos/bin/ld: CSVViewer.mo: in function `_i_MainWindow__filepanelForLoading_encoding_separator_title_lineEnding_':
    /Work/Development/Frameworks/Examples/CSVViewer.m:217: undefined reference to `__objc_class_name_OBApplication'
    /Work/Development/gg/bin/../lib/gcc-lib/ppc-morphos/5.5.0/../../../../ppc-morphos/bin/ld: /Work/Development/gg/bin/../lib/gcc-lib/ppc-morphos/5.5.0/../../../../ppc-morphos/lib/libmui.framework.a(MUIMain.mo): in function `main':
    /Temp/cvs.morphos.net/morphoswb/classes/frameworks/mui/bin/shared/../../MUIMain.m:7: undefined reference to `__objc_class_name_OBApplication'
    collect2: error: ld returned 1 exit status
    make: *** [Makefile:16: CSVViewer] Error 1


    I get this error when compiling the CustomClass2 in FlowStudio:


    Work:Development/Frameworks/Examples
    make: Entering directory '/Work/Development/Frameworks/Examples'
    compiling CustomClass2_RELEASE.mo
    › q› qlinking CustomClass2
    /Work/Development/gg/bin/../lib/gcc-lib/ppc-morphos/5.5.0/../../../../ppc-morphos/bin/ld: cannot find -lobjfw_rt.library
    collect2: error: ld returned 1 exit status
    make: *** [Work:Development/Frameworks/Examples/Makefile.CC2:76: CustomClass2] Error 1
    make: Leaving directory '/Work/Development/Frameworks/Examples'
    ### Build End ###



    [ Edited by IKE 05.12.2020 - 09:46 ]
    IKE

    MacMini G4 1.5Ghz/PowerBook G4 1.67Ghz/PowerMac G5 2.0Ghz DP 7,2 Radeon 9650/256MB

    Join the conversation @ r/morphos
  • »05.12.20 - 18:40
    Profile Visit Website
  • MorphOS Developer
    jacadcaps
    Posts: 2971 from 2003/3/5
    From: Canada
    Sorry about that. For the Flow project, the Linker libraries should be

    Code:
    -lmui.framework -lob-fw.framework -lobjfwrt.library


    Not sure why you're getting that linking error for CSVViewer...

    I'll see if I can push a new SDK by the end of the year... should make all those issues go away.

    [ Edited by jacadcaps 05.12.2020 - 19:09 ]
  • »05.12.20 - 19:03
    Profile Visit Website
  • IKE
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    IKE
    Posts: 146 from 2009/11/7
    From: Southern CA
    Thanks for the help and good news on the possible SDK update...After editing the make to remove the underscore in the -lobjfwrt.library, I now get this error, same as the other project. I also updated it in the project settings:

    Please note I have tried this on a fresh install of the SDK and verified it occurs. I also tried editing the project settings to use GCC 5 and that didn't have any effect:


    ### Build Start ###
    ### Current directory has changed to:
    Work:Development/Frameworks/Examples
    make: Entering directory '/Work/Development/Frameworks/Examples'
    compiling CustomClass2_RELEASE.mo
    › q› qlinking CustomClass2
    /Work/Development/gg/bin/../lib/gcc-lib/ppc-morphos/5.5.0/../../../../ppc-morphos/bin/ld: CustomClass2_RELEASE.mo:(.data.rel.ro+0x28): undefined reference to `__objc_class_name_OBApplication'
    /Work/Development/gg/bin/../lib/gcc-lib/ppc-morphos/5.5.0/../../../../ppc-morphos/bin/ld: /Work/Development/gg/bin/../lib/gcc-lib/ppc-morphos/5.5.0/../../../../ppc-morphos/lib/libmui.framework.a(MUIMain.mo): in function `main':
    /Temp/cvs.morphos.net/morphoswb/classes/frameworks/mui/bin/shared/../../MUIMain.m:7: undefined reference to `__objc_class_name_OBApplication'
    collect2: error: ld returned 1 exit status
    make: *** [Work:Development/Frameworks/Examples/Makefile.CC2:76: CustomClass2] Error 1
    make: Leaving directory '/Work/Development/Frameworks/Examples'
    ### Build End ###
    IKE

    MacMini G4 1.5Ghz/PowerBook G4 1.67Ghz/PowerMac G5 2.0Ghz DP 7,2 Radeon 9650/256MB

    Join the conversation @ r/morphos
  • »05.12.20 - 20:11
    Profile Visit Website
  • IKE
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    IKE
    Posts: 146 from 2009/11/7
    From: Southern CA
    I changed these two lines (original is the comment) and the CustomClass2 will now compile and run:

    Code:
    int main (int argc, const char * argv[])    // int muiMain(int argc, char *argv[])
    {
    ...

    [w notify:@selector(closeRequest) performSelector:@selector(quit) withTarget:[MUIApplication currentApplication]]; // [OBApplication currentApplication]];
    IKE

    MacMini G4 1.5Ghz/PowerBook G4 1.67Ghz/PowerMac G5 2.0Ghz DP 7,2 Radeon 9650/256MB

    Join the conversation @ r/morphos
  • »05.12.20 - 23:35
    Profile Visit Website
  • IKE
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    IKE
    Posts: 146 from 2009/11/7
    From: Southern CA
    Same thing with CSVViewer example

    Code:
    	int main (int argc, const char * argv[])    // int muiMain(int argc, char *argv[]

    and...

    case 666:
    [[MUIApplication currentApplication] quit]; // OBApplication
    IKE

    MacMini G4 1.5Ghz/PowerBook G4 1.67Ghz/PowerMac G5 2.0Ghz DP 7,2 Radeon 9650/256MB

    Join the conversation @ r/morphos
  • »05.12.20 - 23:43
    Profile Visit Website
  • MorphOS Developer
    jacadcaps
    Posts: 2971 from 2003/3/5
    From: Canada
    Well, that's still odd. Do they actually work though? :)

    You can fetch the current linklibs from https://tunkki.dk/~jaca/objclibs.tar.gz
  • »05.12.20 - 23:54
    Profile Visit Website
  • IKE
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    IKE
    Posts: 146 from 2009/11/7
    From: Southern CA
    Yes, they both run and work now. They load .csv files, draw dots on the screen as they both should, respectively. I'll grab those link libs, change the sources back and try to recompile. Thanks

    IKE
    IKE

    MacMini G4 1.5Ghz/PowerBook G4 1.67Ghz/PowerMac G5 2.0Ghz DP 7,2 Radeon 9650/256MB

    Join the conversation @ r/morphos
  • »06.12.20 - 00:01
    Profile Visit Website
  • IKE
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    IKE
    Posts: 146 from 2009/11/7
    From: Southern CA
    OK, just loaded the new libs, changed the sources back and recompiled, those new libs did the trick! Everything is compiling and running now!

    Thanks,
    IKE
    IKE

    MacMini G4 1.5Ghz/PowerBook G4 1.67Ghz/PowerMac G5 2.0Ghz DP 7,2 Radeon 9650/256MB

    Join the conversation @ r/morphos
  • »06.12.20 - 00:49
    Profile Visit Website
  • IKE
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    IKE
    Posts: 146 from 2009/11/7
    From: Southern CA
    Quote:

    jacadcaps wrote:
    Btw do you have any specific examples in mind? I've written tons of ObjC-MUI code and would be happy to provide examples, but just I don't believe in the value of just opensourcing bigger projects since it'd be hard to learn from those.

    I'll try to clean up Zoom enough to put it on github and include in future SDK releases. It's quite small, but also a good illustration of ObjectiveC 2.0 w/ ARC usage.


    As far as what I had in mind, it was snippets similar to the MUI snippets that are included with its SDK but with Objective-C examples. Also programs such as Zoom would be good as well.

    Thanks,
    IKE
    IKE

    MacMini G4 1.5Ghz/PowerBook G4 1.67Ghz/PowerMac G5 2.0Ghz DP 7,2 Radeon 9650/256MB

    Join the conversation @ r/morphos
  • »06.12.20 - 12:41
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    polluks
    Posts: 779 from 2007/10/23
    From: Gelsenkirchen,...
    @jacadcaps
    noixemul is missing in Examples/USB/BootMouse/Makefile
    Pegasos II G4: MorphOS 3.9, Zalman M220W · iMac G5 12,1 17", MorphOS 3.18
    Power Mac G3: OSX 10.3 · PowerBook 5,8: OSX 10.5, MorphOS 3.18
  • »06.12.20 - 16:23
    Profile
  • MorphOS Developer
    jacadcaps
    Posts: 2971 from 2003/3/5
    From: Canada
    Added. I've started re-compiling all of the packages that make up the SDK...
  • »06.12.20 - 16:52
    Profile Visit Website
  • IKE
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    IKE
    Posts: 146 from 2009/11/7
    From: Southern CA
    Great! Sounds good. Thanks!

    IKE
    IKE

    MacMini G4 1.5Ghz/PowerBook G4 1.67Ghz/PowerMac G5 2.0Ghz DP 7,2 Radeon 9650/256MB

    Join the conversation @ r/morphos
  • »09.12.20 - 06:13
    Profile Visit Website