About Monkey 2 › Forums › Monkey 2 Programming Help › Fatal mx2cc error, why?
Tagged: mx2cc error
This topic contains 10 replies, has 4 voices, and was last updated by 
 MikeHart 2 years, 4 months ago.
- 
		AuthorPosts
 - 
		
			
				
November 23, 2016 at 11:22 am #5379
What should this compiler error tell me?
Mx2cc version 1.1.01
***** Building app ‘C:/Monkey2/modules/fantomX2/examples/Objects/Hierachy/ParentChild/ParentChild.monkey2’ *****
Parsing…
Semanting…
Translating…
Compiling…
Build error: System command ‘g++ -I”C:/Monkey2/modules/” -I”C:/Monkey2/modules/monkey/native” -I”C:/Monkey2/modules/fantomX2/examples/Objects/Hierachy/ParentChild/” -std=c++11 -m32 -I”C:/Monkey2/modules/freetype/freetype-2.6.3/include/” -I”C:/Monkey2/modules/openal/openal-soft/include/” -I”C:/Monkey2/modules/gles20/angle/include/” -I”C:/Monkey2/modules/sdl2/SDL/include/” -c -o “C:/Monkey2/modules/fantomX2/examples/Objects/Hierachy/ParentChild/ParentChild.buildv1.1.01/windows_debug/build/_1include_2_0r.cpp.o” “C:/Monkey2/modules/fantomX2/examples/Objects/Hierachy/ParentChild/ParentChild.buildv1.1.01/windows_debug/include/_r.cpp”‘ failed.g++ -I”C:/Monkey2/modules/” -I”C:/Monkey2/modules/monkey/native” -I”C:/Monkey2/modules/fantomX2/examples/Objects/Hierachy/ParentChild/” -std=c++11 -m32 -I”C:/Monkey2/modules/freetype/freetype-2.6.3/include/” -I”C:/Monkey2/modules/openal/openal-soft/include/” -I”C:/Monkey2/modules/gles20/angle/include/” -I”C:/Monkey2/modules/sdl2/SDL/include/” -c -o “C:/Monkey2/modules/fantomX2/examples/Objects/Hierachy/ParentChild/ParentChild.buildv1.1.01/windows_debug/build/_1include_2_0r.cpp.o” “C:/Monkey2/modules/fantomX2/examples/Objects/Hierachy/ParentChild/ParentChild.buildv1.1.01/windows_debug/include/_r.cpp”
In file included from C:/Monkey2/modules/monkey/native/bbmonkey.h:12:0,
from C:/Monkey2/modules/fantomX2/examples/Objects/Hierachy/ParentChild/ParentChild.buildv1.1.01/windows_debug/include/_r.cpp:1:
C:/Monkey2/modules/monkey/native/bbgc.h: In instantiation of ‘void bbGCVar<T>::enqueue() [with T = t_fantomX2_cftObject_ftObject]’:
C:/Monkey2/modules/monkey/native/bbgc.h:229:10: required from ‘bbGCVar<T>::bbGCVar(T*) [with T = t_fantomX2_cftObject_ftObject]’
C:/Monkey2/modules/fantomX2/examples/Objects/Hierachy/ParentChild/ParentChild.buildv1.1.01/windows_debug/include/ParentChild_ParentChild.h:41:85: required from here
C:/Monkey2/modules/monkey/native/bbgc.h:221:18: error: cannot dynamic_cast ‘((bbGCVar<t_fantomX2_cftObject_ftObject>*)this)->bbGCVar<t_fantomX2_cftObject_ftObject>::_ptr’ (of type ‘struct t_fantomX2_cftObject_ftObject*’) to type ‘struct bbGCNode*’ (source is a pointer to incomplete type)
bbGC::enqueue( dynamic_cast<bbGCNode*>( _ptr ) );
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
***** Fatal mx2cc error *****
Internal mx2cc build error
November 23, 2016 at 1:18 pm #5384Ok, found it. This NULL assigment to an object declaration was causing it:
Monkey1Field parent:ftObject = NullMake it
Monkey1Field parent:ftObjectand it works.
November 23, 2016 at 11:21 pm #5398Looks like a bug to me. Could you post it on GitHub?
November 24, 2016 at 12:51 pm #5415I am not sure. I think it is by design. For whatever odd reason it might be.
November 24, 2016 at 1:22 pm #5416It’s a bug. Monkey2 should have caught it.
November 24, 2016 at 2:38 pm #5417ok. No problem. I can work around it.
November 24, 2016 at 9:28 pm #5421Can you recreate it in a simple example?
This compile okay using v1.1.01:
Monkey1234567891011121314151617181920212223Namespace myapp#Import "<std>"Using std..Class MyObjectField x:IntEndClass MyTestField test:MyObject = NullMethod New()test = New MyObjecttest.x = 100EndEndFunction Main()Local t := New MyTestPrint t.test.xEndNovember 25, 2016 at 6:47 pm #5435I will see what I can do.
November 25, 2016 at 6:57 pm #5436Here you go. Offending line is #15:
Monkey12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061Namespace bugtest#Import "<std>"#Import "<mojo>"Using std..Using mojo..' The _g variable holds an instance to the cGame classGlobal _g:cGameClass myObject2Field x:FloatField y:FloatField subObj2:List<myObject> = NullEndClass myObjectField x:FloatField y:FloatField subObj:myObject2 = NullEnd'***************************************' The cGame class controls the appClass cGame Extends Window' Create a field to store the instance of the cEngine class, which is an instance' of the ftEngine class itselfField mo:myObject = Null'------------------------------------------Method New()'Super.New("fantomX2 Test",App.DesktopSize.X,App.DesktopSize.Y,Null)Super.New("Test",640,480,Null)ClearColor=New Color( 0,0,0 )mo = New myObjectEnd'------------------------------------------Method OnRender:void(canvas:Canvas) OverrideApp.RequestRender()canvas.DrawText("xxxx", 320,240)EndEnd'***************************************Function Main()New AppInstance_g = New cGameApp.Run()EndNovember 25, 2016 at 10:45 pm #5438Thanks for posting sample code!
It appears to be fixed now (due to fixes to related stuff) although only in the develop branch which I wouldn’t recommended using just yet.
November 26, 2016 at 10:44 am #5440Thanks!
 - 
		AuthorPosts
 
You must be logged in to reply to this topic.