I have two NXT bricks connected and they work together using Bluetooth, sending messages between the two works. The master NXT will start a program on the slave NXT with the RemoteStartProgram function. However, when I try to use RemoteStopProgram the compilation fails with 'Unknown function' in BricxCC and with this error when compiled with nbc:

File "/home/paul/bricks/carjulie_bt.nxc" ; line 124
#   __connectionWrite (1, __DCStopProgramPacket, __D0main)
1 errors during compilation

This is the relevant portion of the code, what am I missing ?

task main() {
  if (BTConnectToNXT("Sarah", SLAVE_CONN)) {
    RemoteStartProgram(SLAVE_CONN, "carsarah_bt.rxe");
    bool result = RemoteConnectionIdle(SLAVE_CONN);
    if (result) {
    RemoteStopProgram(SLAVE_CONN);  // This line does not compile ?!

Edit 2020-05-16: There is a simple workaround for this error, just send a message to all slaves to execute stopalltasks() function.

This bug is now also on Debian bugs: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=960772

EDIT 2020-05-18: SOLVED! This link https://sourceforge.net/p/bricxcc/code/HEAD/tree/x64/ contains a working nbc version for Linux! Thanks!!

  • According to the [bricxcc.sourceforge.net/nbc/nxcdoc/nxcapi/… reference) this call is perfectly legal. Are you sure your RemoteStopProgram(SLAVE_CONN); // This line does not compile ?! line is the one referenced in the error message ("/home/paul/bricks/carjulie_bt.nxc" ; line 124)? – zovits May 13 at 8:50
  • Yes I am sure. I have tried moving that line to other tasks, same thing. I have also tried with 1 instead of SLAVE_CONN and with assigning a byte instead of a #define. This one function always fails, no matter how I write it. I have also copied the line from programs on the internet, same thing, it does not compile... – Paul May 13 at 8:57
  • BricxCC says "Error Unknown or Invalid Statement". – Paul May 13 at 9:02
  • This line compiles in the old version 3388 of BricxCC (but there are other breaking issues with this old version). – Paul May 13 at 12:08
  • What happens if you assign the return value to a variable? result = RemoteStopProgram(SLAVE_CONN) – David Lechner May 13 at 15:04

Try changing which version of BricxCC you're using to one of the later releases: http://bricxcc.sourceforge.net/test_releases/?C=M;O=D

What version are you using now? I duplicated the compile error on v3.3.8.9, but I didn't get the compile error on v3.3.8.11: http://bricxcc.sourceforge.net/test_releases/test_release20131007.zip

Hope that works!

PS: I didn't test anything, as I'm not using the feature -- I just saw it would compile on a different version.

If you use this, make sure you review compiler settings, as it looks like the newer version has [x] Enhanced Firmware option checked by default (which you may or may not have installed on your NXT brick, if using stock LEGO firmware).

Update #1:

According to https://sourceforge.net/p/bricxcc/code/HEAD/tree/NXT/history.txt, it may be a known issue that was fixed in a newer release:

Version 1.2.1.r5 (2013-02-16) : - Fixed definition for several Remote* API functions which sent direct/system commands to other NXT devices via Bluetooth or RS-485

So, it looks like 1.2.1r5 or newer version of NBC command-line tools may be required.

Also, the test release I downloaded (v3.3.8.11 of GUI) has nbc.exe v1.2.1.5, while the other version I have (v3.3.8.9 of GUI) has nbc.exe v1.2.1.4 -- so this may be the issue.

Update #2:

For Linux, see https://sourceforge.net/p/bricxcc/code/HEAD/tree/386/ and https://sourceforge.net/p/bricxcc/code/HEAD/tree/x64/ 32 and 64-bit binaries, respectively.

| improve this answer | |
  • Thank you bitbob for this valid answer. I just tried it with wine on Debian and it works. I am however addicted to working with vi on Debian Linux, starting a GUI for every compile is not an option. The nbc tool on Linux does not seem to be included in these test updates; there is Linuxtools.zip file, but it contains .exe files and they fail in wine. For now I use the following workaround: send a message to the slaves to execute stopalltasks() so I can keep my workflow. Still, it would be nice to have this function on Linux. – Paul May 16 at 13:50
  • What version of command line tools are you using? I see bricxcc.sourceforge.net/nbc/release/index.html has 1.2.1r5 (Oct 18, 2011), but not sure how it compares to the BricxCC GUI releases. – bitbob May 17 at 14:50
  • Sorry, I spoke too soon -- it looks like sourceforge.net/projects/bricxcc/files/NBC_NXC only actually lists through 1.2.1r4 ... and the links at above URL for 1.2.1r5 aren't valid and just redirect you to sourceforge.net/projects/bricxcc/files which doesn't have 1.21r5 files. – bitbob May 17 at 18:58
  • However, I did also find sourceforge.net/p/bricxcc/code/HEAD/tree/386 and sourceforge.net/p/bricxcc/code/HEAD/tree/x64 which might be the right files for Linux binaries? Sorry, I'm on Windows, so cannot test myself. If they work, I'll update my answer to reference these links for new Linux binaries, too. – bitbob May 17 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.