Unable to create module
BlitzMax Forums/BlitzMax Beginners Area/Unable to create module
| ||
I have this code:
Strict
Module SG.GetParameterNameNValue
Import BRL.Basic
Import BRL.Blitz
Function GetParameterName$(LineFromFileRead$)
' This function returns the first part of the given string
' It takes all chars from the first char to the "=" and removes the spaces, tabs and the "=" from it
Local PosInString%
Local ParameterName$
' Find position of the "="-character
PosInString% = Instr(LineFromFileRead$, Chr(61))
' If no match ("=") has been found, return entire "LineFromFile" (instead of nothing)
If PosInString% = 0 Then
PosInString% = Len(LineFromFileRead$)
EndIf
' Get first chars from the string until the "="
ParameterName$ = Left$(LineFromFileRead$, PosInString%)
' Replace:
' - tab-chars (= Chr(9))
' - spaces (= Chr(32))
' - equal sign (= Chr(61))
' with nothing (= ""), so only the parameter-name remains
ParameterName$ = Replace$(ParameterName$, Chr(9), "")
ParameterName$ = Replace$(ParameterName$, Chr(32), "")
ParameterName$ = Replace$(ParameterName$, Chr(61), "")
' Return the parameter name
Return ParameterName$
End Function
Function GetParameterValue$(LineFromFileRead$)
' This function returns the second part of the given string
' It takes all the chars from the position of the ("=" + 2) to the end of the string
Local PosInString%
Local ParameterValue$
' Find position of the "="-character
PosInString% = Instr(LineFromFileRead$, Chr(61))
' Get the last chars from the string (starting from the position of the ("=" + 2 chars))
ParameterValue$ = Mid$(LineFromFileRead$, PosInstring% + 2)
' Return the parameter value
Return ParameterValue$
End Function
I saved this file here: c:\BlitzMax\Mod\SG.mod\GetParameterNameNValue.mod\GetParameterNameNValue.bmx When I choose "Build modules" in the IDE, I get an error, stating the "Instr"-identifier hasn't been found. I tried importing BRL.Basic and BRL.Blitz (as you can see), but then I got the same error. The docs say that the Instr-function is part of the Basic-module. Can anyone help me with this? Which module(s) do I have to Import to be able to build this module? |
| ||
| try Import BRL.Retro, will check the docs... |
| ||
| Now the module compiles without any errors (in debug and release mode), but when I shutdown BMax, restart it and try to use the functions, then I get the error "Identifier 'GetParameterName' not found". When I try to import my mod (using "Import sg.GetParameterNameNValue"), then I get the error "Can't find interface for module SG.GetParameterNameNValue". [Edit] I saw in the mods directory that all modules used lowercase characters only, so I tried it too for my mod and now it works, while using the "bmk makemods" command in the dos-prompt. Is it required that all module names and directories must be lowercase? [/Edit] |
| ||
| I had a lot of trouble compiling, until I switched to all lowercase too. |
| ||
| I know you said you fixed it, but this utility by jb tells you what mods need to be included. http://www.blitzmax.com/Community/posts.php?topic=47141 |