Page 1 of 1

Can't get even basic math functions working

Posted: 31 Jan 2012, 19:51
by elendurwen
Hi,

I downloaded the latest nxc hardware onto my brick from http://bricxcc.sourceforge.net/test_releases/ but I still cannot use even basic maths functions like floor. Also, I am unable to use some NXC-specific functions like FormatNum.

My current program

Code: Select all

task main()
{
    int y = floor(23.0);
}
fails with message 'Undefined identifier floor'
I am compiling the program on MacOSX using the following makefile:

Code: Select all

# Config
USB=-U

# Path to the NXC compiler relative to the Makefile
NXC=/Developer/SDKs/nxt/nbc
NXTCOM=/Developer/SDKs/nxt/nxtcom

# Options to pass to the compiler
OPTIONS=-Z2 -I=../$(SOURCE)/

# Program settings
SOURCE=source
BUILD=build
PROGRAM=MyProject


############

all: $(PROGRAM).rxe download

$(PROGRAM).rxe: $(SOURCE)/$(PROGRAM).nxc Makefile
	cd $(SOURCE); \
	$(NXC) -O=../$(BUILD)/$(PROGRAM).rxe  \
				$(OPTIONS) \
                $(PROGRAM).nxc 

download: $(PROGRAM).rxe
	cd $(BUILD);  \
	$(NXTCOM) $(USB) $(PROGRAM).rxe
	
clean:
	/bin/rm -vf build/$(PROGRAM).rxe
I am not sure what to do, could you please help? I am obviously missing something.

Re: Can't get even basic math functions working

Posted: 31 Jan 2012, 20:00
by mattallen37
Make sure your compiler settings match your EFW.

Re: Can't get even basic math functions working

Posted: 31 Jan 2012, 21:00
by afanofosc
I've replied to this query that I also received via email but I will also post here.

You need to add -EF to your makefile where you set the command line options.

John Hansen