Can't get even basic math functions working

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
elendurwen
Posts: 16
Joined: 31 Jan 2012, 19:44

Can't get even basic math functions working

Post 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.
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Can't get even basic math functions working

Post by mattallen37 »

Make sure your compiler settings match your EFW.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: Can't get even basic math functions working

Post 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
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 4 guests