You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry if this is a bother or the wrong place to post this but, I'm just getting started with Mojo, and the things I want to make most with it are 3D and game engine related things, so of course trusty old SDL is where to start right. I felt fortunate that someone had already tackled this. But I can't get it to work. I think it's due to language changes as I'm running into even the basics of the language in tutorials no longer being features of the language (for example 'let' seems to have been removed entirely). It seems the way pointers are handled is different now too, but I can't figure out more than that.
Best I can tell it's two things it's tripping on, Pointers and init, both of which are red underlined in vscode, but I don't know enough about how mojo interacts with C to be able to fix it on my own. I've been reading documentaiton the last two days to try to fix it myself, but I think I'm too much of a noob. So I'll at least report it here.
using linux mint 22 - Cinnamon 64-bit, which is more or less Ubuntu 24.04
inside of 'magic shell' and typing 'mojo run SDL.mojo' I get the following errors:
`/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:67:17: error: 'SDL_Surface' has no 'Pointer' member
var format: Pointer[SDL_PixelFormat]
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:71:17: error: 'SDL_Surface' has no 'Pointer' member
var pixels: Pointer[UInt32]
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:72:19: error: 'SDL_Surface' has no 'Pointer' member
var userdata: Pointer[Int8]
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:74:23: error: 'SDL_Surface' has no 'Pointer' member
var list_blitmap: Pointer[Int8]
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:76:14: error: 'SDL_Surface' has no 'Pointer' member
var map: Pointer[Int8]
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:195:31: error: use of unknown declaration 'DTypePointer'
alias c_SDL_CreateWindow = fn(DTypePointer[DType.int8], Int32, Int32, Int32, Int32, Int32) -> Pointer[SDL_Window]
^~~~~~~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:195:95: error: use of unknown declaration 'Pointer'
alias c_SDL_CreateWindow = fn(DTypePointer[DType.int8], Int32, Int32, Int32, Int32, Int32) -> Pointer[SDL_Window]
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:196:32: error: use of unknown declaration 'Pointer'
alias c_SDL_DestroyWindow = fn(Pointer[SDL_Window]) -> None
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:197:38: error: use of unknown declaration 'Pointer'
alias c_SDL_GetWindowSurface = fn(s: Pointer[Int8]) -> Pointer[SDL_Surface]
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:197:56: error: use of unknown declaration 'Pointer'
alias c_SDL_GetWindowSurface = fn(s: Pointer[Int8]) -> Pointer[SDL_Surface]
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:198:41: error: use of unknown declaration 'Pointer'
alias c_SDL_UpdateWindowSurface = fn(s: Pointer[Int8]) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:207:28: error: use of unknown declaration 'Pointer'
alias c_SDL_PollEvent = fn(Pointer[Event]) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:210:33: error: use of unknown declaration 'Pointer'
alias c_SDL_CreateRenderer = fn(Pointer[SDL_Window], Int32, UInt32) -> Pointer[SDL_Renderer]
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:210:72: error: use of unknown declaration 'Pointer'
alias c_SDL_CreateRenderer = fn(Pointer[SDL_Window], Int32, UInt32) -> Pointer[SDL_Renderer]
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:211:64: error: use of unknown declaration 'Pointer'
alias c_SDL_CreateWindowAndRenderer = fn(Int32, Int32, UInt32, Pointer[Pointer[Int8]], Pointer[Pointer[SDL_Renderer]]) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:211:88: error: use of unknown declaration 'Pointer'
alias c_SDL_CreateWindowAndRenderer = fn(Int32, Int32, UInt32, Pointer[Pointer[Int8]], Pointer[Pointer[SDL_Renderer]]) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:212:34: error: use of unknown declaration 'Pointer'
alias c_SDL_RenderDrawPoint = fn(Pointer[SDL_Renderer], Int32, Int32) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:213:36: error: use of unknown declaration 'Pointer'
alias c_SDL_RenderDrawRect = fn(r: Pointer[SDL_Renderer], rect: Pointer[SDL_Rect]) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:213:65: error: use of unknown declaration 'Pointer'
alias c_SDL_RenderDrawRect = fn(r: Pointer[SDL_Renderer], rect: Pointer[SDL_Rect]) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:214:35: error: use of unknown declaration 'Pointer'
alias c_SDL_RenderPresent = fn(s: Pointer[SDL_Renderer]) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:215:33: error: use of unknown declaration 'Pointer'
alias c_SDL_RenderClear = fn(s: Pointer[SDL_Renderer]) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:216:37: error: use of unknown declaration 'Pointer'
alias c_SDL_SetRenderDrawColor = fn(Pointer[SDL_Renderer], UInt8, UInt8, UInt8, UInt8) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:218:41: error: use of unknown declaration 'Pointer'
alias c_SDL_SetRenderDrawBlendMode = fn(Pointer[SDL_Renderer], SDL_BlendMode) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:219:37: error: use of unknown declaration 'Pointer'
alias c_SDL_SetRenderTarget = fn(r: Pointer[SDL_Renderer],
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:223:32: error: use of unknown declaration 'Pointer'
alias c_SDL_RenderCopy = fn(r: Pointer[SDL_Renderer],
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:229:27: error: use of unknown declaration 'Pointer'
alias c_SDL_FillRect = fn(Pointer[SDL_Surface], Int64, UInt32) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:233:32: error: use of unknown declaration 'Pointer'
alias c_SDL_CreateTexture = fn(Pointer[SDL_Renderer],
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:144:9: error: self argument must be present in instance method
def init() -> Event:
^
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:155:16: error: use of unknown declaration 'Pointer'
return Pointer.address_of(self).bitcastKeyevent.load()
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:158:16: error: use of unknown declaration 'Pointer'
return Pointer.address_of(self).bitcastMouseMotionEvent.load()
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:161:16: error: use of unknown declaration 'Pointer'
return Pointer.address_of(self).bitcastMouseButtonEvent.load()
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:164:16: error: use of unknown declaration 'Pointer'
return Pointer.address_of(self).bitcastMouseWheelEvent.load()
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:180:9: error: 'init' result type must be elided (or None)
def init(inout self) -> Self:
^
mojo: error: failed to parse the provided Mojo source module
(revolution-engine) mike@mike-Blade:~/Desktop/Mojo/revolution-engine/SDL-Old$
`
The text was updated successfully, but these errors were encountered:
Sorry if this is a bother or the wrong place to post this but, I'm just getting started with Mojo, and the things I want to make most with it are 3D and game engine related things, so of course trusty old SDL is where to start right. I felt fortunate that someone had already tackled this. But I can't get it to work. I think it's due to language changes as I'm running into even the basics of the language in tutorials no longer being features of the language (for example 'let' seems to have been removed entirely). It seems the way pointers are handled is different now too, but I can't figure out more than that.
Best I can tell it's two things it's tripping on, Pointers and init, both of which are red underlined in vscode, but I don't know enough about how mojo interacts with C to be able to fix it on my own. I've been reading documentaiton the last two days to try to fix it myself, but I think I'm too much of a noob. So I'll at least report it here.
using linux mint 22 - Cinnamon 64-bit, which is more or less Ubuntu 24.04
inside of 'magic shell' and typing 'mojo run SDL.mojo' I get the following errors:
`/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:67:17: error: 'SDL_Surface' has no 'Pointer' member
var format: Pointer[SDL_PixelFormat]
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:71:17: error: 'SDL_Surface' has no 'Pointer' member
var pixels: Pointer[UInt32]
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:72:19: error: 'SDL_Surface' has no 'Pointer' member
var userdata: Pointer[Int8]
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:74:23: error: 'SDL_Surface' has no 'Pointer' member
var list_blitmap: Pointer[Int8]
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:76:14: error: 'SDL_Surface' has no 'Pointer' member
var map: Pointer[Int8]
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:195:31: error: use of unknown declaration 'DTypePointer'
alias c_SDL_CreateWindow = fn(DTypePointer[DType.int8], Int32, Int32, Int32, Int32, Int32) -> Pointer[SDL_Window]
^~~~~~~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:195:95: error: use of unknown declaration 'Pointer'
alias c_SDL_CreateWindow = fn(DTypePointer[DType.int8], Int32, Int32, Int32, Int32, Int32) -> Pointer[SDL_Window]
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:196:32: error: use of unknown declaration 'Pointer'
alias c_SDL_DestroyWindow = fn(Pointer[SDL_Window]) -> None
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:197:38: error: use of unknown declaration 'Pointer'
alias c_SDL_GetWindowSurface = fn(s: Pointer[Int8]) -> Pointer[SDL_Surface]
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:197:56: error: use of unknown declaration 'Pointer'
alias c_SDL_GetWindowSurface = fn(s: Pointer[Int8]) -> Pointer[SDL_Surface]
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:198:41: error: use of unknown declaration 'Pointer'
alias c_SDL_UpdateWindowSurface = fn(s: Pointer[Int8]) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:207:28: error: use of unknown declaration 'Pointer'
alias c_SDL_PollEvent = fn(Pointer[Event]) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:210:33: error: use of unknown declaration 'Pointer'
alias c_SDL_CreateRenderer = fn(Pointer[SDL_Window], Int32, UInt32) -> Pointer[SDL_Renderer]
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:210:72: error: use of unknown declaration 'Pointer'
alias c_SDL_CreateRenderer = fn(Pointer[SDL_Window], Int32, UInt32) -> Pointer[SDL_Renderer]
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:211:64: error: use of unknown declaration 'Pointer'
alias c_SDL_CreateWindowAndRenderer = fn(Int32, Int32, UInt32, Pointer[Pointer[Int8]], Pointer[Pointer[SDL_Renderer]]) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:211:88: error: use of unknown declaration 'Pointer'
alias c_SDL_CreateWindowAndRenderer = fn(Int32, Int32, UInt32, Pointer[Pointer[Int8]], Pointer[Pointer[SDL_Renderer]]) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:212:34: error: use of unknown declaration 'Pointer'
alias c_SDL_RenderDrawPoint = fn(Pointer[SDL_Renderer], Int32, Int32) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:213:36: error: use of unknown declaration 'Pointer'
alias c_SDL_RenderDrawRect = fn(r: Pointer[SDL_Renderer], rect: Pointer[SDL_Rect]) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:213:65: error: use of unknown declaration 'Pointer'
alias c_SDL_RenderDrawRect = fn(r: Pointer[SDL_Renderer], rect: Pointer[SDL_Rect]) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:214:35: error: use of unknown declaration 'Pointer'
alias c_SDL_RenderPresent = fn(s: Pointer[SDL_Renderer]) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:215:33: error: use of unknown declaration 'Pointer'
alias c_SDL_RenderClear = fn(s: Pointer[SDL_Renderer]) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:216:37: error: use of unknown declaration 'Pointer'
alias c_SDL_SetRenderDrawColor = fn(Pointer[SDL_Renderer], UInt8, UInt8, UInt8, UInt8) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:218:41: error: use of unknown declaration 'Pointer'
alias c_SDL_SetRenderDrawBlendMode = fn(Pointer[SDL_Renderer], SDL_BlendMode) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:219:37: error: use of unknown declaration 'Pointer'
alias c_SDL_SetRenderTarget = fn(r: Pointer[SDL_Renderer],
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:223:32: error: use of unknown declaration 'Pointer'
alias c_SDL_RenderCopy = fn(r: Pointer[SDL_Renderer],
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:229:27: error: use of unknown declaration 'Pointer'
alias c_SDL_FillRect = fn(Pointer[SDL_Surface], Int64, UInt32) -> Int32
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:233:32: error: use of unknown declaration 'Pointer'
alias c_SDL_CreateTexture = fn(Pointer[SDL_Renderer],
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:144:9: error: self argument must be present in instance method
def init() -> Event:
^
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:155:16: error: use of unknown declaration 'Pointer'
return Pointer.address_of(self).bitcastKeyevent.load()
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:158:16: error: use of unknown declaration 'Pointer'
return Pointer.address_of(self).bitcastMouseMotionEvent.load()
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:161:16: error: use of unknown declaration 'Pointer'
return Pointer.address_of(self).bitcastMouseButtonEvent.load()
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:164:16: error: use of unknown declaration 'Pointer'
return Pointer.address_of(self).bitcastMouseWheelEvent.load()
^~~~~~~
/home/mike/Desktop/Mojo/revolution-engine/SDL-Old/SDL.mojo:180:9: error: 'init' result type must be elided (or None)
def init(inout self) -> Self:
^
mojo: error: failed to parse the provided Mojo source module
(revolution-engine) mike@mike-Blade:~/Desktop/Mojo/revolution-engine/SDL-Old$
`
The text was updated successfully, but these errors were encountered: