Fail to compile

About Monkey 2 Forums Monkey 2 Programming Help Fail to compile

This topic contains 4 replies, has 3 voices, and was last updated by  Jesse 2 years, 10 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1759

    Jesse
    Participant

    I can’t figure this error out. The code translate with out problems but when it compiles, the c compiler complains about an error:

    it translate fine but when it compiles the c compiler complains and gives me an error:

    <quote>

    mx2cc version 1.0.0

    ***** Building app ‘/Users/legend/Desktop/monkeypatrol/src/testlist.monkey2’ *****

    Parsing…
    Semanting…
    Translating…
    Compiling….
    Build error: System command ‘g++ -std=c++11 -Wno-deprecated-declarations -Wno-tautological-pointer-compare -Wno-undefined-bool-conversion -Wno-int-to-void-pointer-cast -Wno-inconsistent-missing-override -Wno-logical-op-parentheses -Wno-parentheses-equality -O0 -I”/Users/legend/monkey2/modules/monkey/native” -c -o “/Users/legend/Desktop/monkeypatrol/src/testlist.buildv1.0.0/build_cache/desktop_debug_macos/testlist_0testlist.cpp.o” “/Users/legend/Desktop/monkeypatrol/src/testlist.buildv1.0.0/build_cache/desktop_debug_macos/testlist_testlist.cpp”‘ failed.

    g++ -std=c++11 -Wno-deprecated-declarations -Wno-tautological-pointer-compare -Wno-undefined-bool-conversion -Wno-int-to-void-pointer-cast -Wno-inconsistent-missing-override -Wno-logical-op-parentheses -Wno-parentheses-equality -O0 -I”/Users/legend/monkey2/modules/monkey/native” -c -o “/Users/legend/Desktop/monkeypatrol/src/testlist.buildv1.0.0/build_cache/desktop_debug_macos/testlist_0testlist.cpp.o” “/Users/legend/Desktop/monkeypatrol/src/testlist.buildv1.0.0/build_cache/desktop_debug_macos/testlist_testlist.cpp”

    In file included from /Users/legend/Desktop/monkeypatrol/src/testlist.buildv1.0.0/build_cache/desktop_debug_macos/testlist_testlist.cpp:2:
    In file included from /Users/legend/Desktop/monkeypatrol/src/testlist.buildv1.0.0/build_cache/desktop_debug_macos/testlist_testlist.h:5:
    In file included from /Users/legend/monkey2/modules/monkey/native/bbmonkey.h:13:
    /Users/legend/monkey2/modules/monkey/native/bbobject.h:48:11: error: allocating an object of abstract class type ‘t_default_HitBox’
    T *p=new T( a… );
    ^
    /Users/legend/Desktop/monkeypatrol/src/testlist.buildv1.0.0/build_cache/desktop_debug_macos/testlist_testlist.cpp:26:35: note: in instantiation of function template specialization ‘bbGCNew<t_default_HitBox, t_default_PVector2D *, float, float, float, float>’ requested here
    f0.l_v1=((t_default_Collision*)(bbGCNew<t_default_HitBox>(f0.t0=bbGCNew<t_default_PVector2D>(7.0f,56.0f),30.0f,40.0f,50.0f,48.0f)));
    ^
    /Users/legend/Desktop/monkeypatrol/src/testlist.buildv1.0.0/build_cache/desktop_debug_macos/testlist_testlist.h:48:16: note: unimplemented pure virtual method ‘m_Set’ in ‘t_default_HitBox’
    virtual void m_Set(t_default_PVector2D* l_pos,bbFloat l_ox,bbFloat l_oy,bbFloat l_radius)=0;
    ^
    In file included from /Users/legend/Desktop/monkeypatrol/src/testlist.buildv1.0.0/build_cache/desktop_debug_macos/testlist_testlist.cpp:2:
    In file included from /Users/legend/Desktop/monkeypatrol/src/testlist.buildv1.0.0/build_cache/desktop_debug_macos/testlist_testlist.h:5:
    In file included from /Users/legend/monkey2/modules/monkey/native/bbmonkey.h:13:
    /Users/legend/monkey2/modules/monkey/native/bbobject.h:48:11: error: allocating an object of abstract class type ‘t_default_HitCircle’
    T *p=new T( a… );
    ^
    /Users/legend/Desktop/monkeypatrol/src/testlist.buildv1.0.0/build_cache/desktop_debug_macos/testlist_testlist.cpp:29:35: note: in instantiation of function template specialization ‘bbGCNew<t_default_HitCircle, t_default_PVector2D *, float, float, float>’ requested here
    f0.l_v2=((t_default_Collision*)(bbGCNew<t_default_HitCircle>(f0.t0=bbGCNew<t_default_PVector2D>(28.0f,17.0f),10.0f,15.0f,20.0f)));
    ^
    /Users/legend/Desktop/monkeypatrol/src/testlist.buildv1.0.0/build_cache/desktop_debug_macos/testlist_testlist.h:49:16: note: unimplemented pure virtual method ‘m_Set’ in ‘t_default_HitCircle’
    virtual void m_Set(t_default_PVector2D* l_pos,bbFloat l_ox,bbFloat l_oy,bbFloat l_width,bbFloat l_height)=0;
    ^
    2 errors generated.
    ***** Fatal mx2cc error *****

    Build error.

    </quote>

    #1769

    olejr
    Participant

    Don’t you have to implement every one of those abstract methods in (both of) those inherited classes?

    Random pick from a google search:

    “abstract classes are used to enforce methods that need to be overridden in the derived classes, thus avoiding potential runtime errors.”

    #1770

    Jesse
    Participant

    Thanks Olejr! that appeared to have solved it.

    My question now is. Shouldn’t monkey be able to detect that?

    #1771

    therevills
    Participant

    Yes MX2 should have detected that – raise a bug over on GitHub 🙂

    #1774

    Jesse
    Participant

    Will do. Thanks.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.