invalid opcode: fmtnum

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
artistjohn
Posts: 2
Joined: 29 Apr 2013, 20:55

invalid opcode: fmtnum

Post by artistjohn »

When compiling code containing

Code: Select all

    lin = FormatNum("WriteResult = %d", lResult);
I get a compile error Invalid opcode: fmtnum

So the compiler is translating the FormatNum into a line of NBC (I guess...) using the fmtnum function, but then the assembler is not finding the symbol definition??
Apparently I have messed up the installation of bricxcc or the associated libraries, header files, or something.

Could use a bit of help here, since I'm completely new to this.
I have version 3.3, build 3.3.8.9 of bricxcc, and have downloaded firmware 1.31 to the NXT.

Thanks,
John
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: invalid opcode: fmtnum

Post by HaWe »

hey,
what if you type

Code: Select all

FormatNum
into your BCC code editor and press F1?

if there's an error,too: best to reinstall the latest BCC and the lates bugfix on your PC, and the latest EFW on your NXT brick
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: invalid opcode: fmtnum

Post by afanofosc »

This is one of a number of features in NXC which require the enhanced NBC/NXC firmware. You need to have it installed on your NXT and tell the compiler to target the enhanced firmware. This is most easily done if you install the latest test release installer of version 3.3.8.10 which is available at http://bricxcc.sourceforge.net/test_releases/

Make sure you have checked the "enhanced firmware" and "2.0 firmware" and "automatic firmware" options on the NBC/NXC tab on the Compilers page in the Preferences dialog.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
artistjohn
Posts: 2
Joined: 29 Apr 2013, 20:55

Re: invalid opcode: fmtnum

Post by artistjohn »

Thanks very much for your help, John. Everything is compiling fine now.

I've enjoyed reading your book on "Power Programming", but haven't read it completely through, yet. As a retired software engineer, I'm looking forward to doing a little "recreational programming".
Post Reply

Who is online

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