Answers.Body: <p>Try changing which version of BricxCC you're using to one of the later releases:
  <a href="http://bricxcc.sourceforge.net/test_releases/?C=M;O=D" rel="nofollow noreferrer">http://bricxcc.sourceforge.net/test_releases/?C=M;O=D</a></p>
  
  <p>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:
  <a href="http://bricxcc.sourceforge.net/test_releases/test_release20131007.zip" rel="nofollow noreferrer">http://bricxcc.sourceforge.net/test_releases/test_release20131007.zip</a></p>
  
  <p>Hope that works!</p>
  
  <p>PS: I didn't test anything, as I'm not using the feature -- I just saw it would compile on a different version.</p>
  
  <p>If you use this, make sure you review compiler settings, as it looks like the newer version has <strong>[x] Enhanced Firmware</strong> option checked by default (which you may or may not have installed on your NXT brick, if using stock LEGO firmware).</p>
  
  <h2>Update #1:</h2>
  
  <p>According to <a href="https://sourceforge.net/p/bricxcc/code/HEAD/tree/NXT/history.txt" rel="nofollow noreferrer">https://sourceforge.net/p/bricxcc/code/HEAD/tree/NXT/history.txt</a>, it may be a known issue that was fixed in a newer release:</p>
  
  <p><code>Version 1.2.1.r5 (2013-02-16)
     <em>:</em>
  - Fixed definition for several Remote* API functions which sent direct/system commands 
    to other NXT devices via Bluetooth or RS-485
  </code></p>
  
  <p>So, it looks like 1.2.1r5 or newer version of NBC command-line tools may be required.</p>
  
  <p>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.</p>
  
  <h2>Update #2:</h2>
  
  <p>For Linux, see <a href="https://sourceforge.net/p/bricxcc/code/HEAD/tree/386/" rel="nofollow noreferrer">https://sourceforge.net/p/bricxcc/code/HEAD/tree/386/</a> and <a href="https://sourceforge.net/p/bricxcc/code/HEAD/tree/x64/" rel="nofollow noreferrer">https://sourceforge.net/p/bricxcc/code/HEAD/tree/x64/</a> 32 and 64-bit binaries, respectively.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-16T13:50:41.320Z
Answers.Text: 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.
Answers.UserDisplayName: Paul
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-17T14:50:22.750Z
Answers.Text: What version of command line tools are you using?  I see http://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.
Answers.UserDisplayName: bitbob
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-17T18:58:33.103Z
Answers.Text: Sorry, I spoke too soon -- it looks like https://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 https://sourceforge.net/projects/bricxcc/files/ which doesn't have 1.21r5 files.
Answers.UserDisplayName: bitbob
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-17T19:10:58.887Z
Answers.Text: However, I did also find https://sourceforge.net/p/bricxcc/code/HEAD/tree/386/
  and https://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.
Answers.UserDisplayName: bitbob
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-15T21:08:47.487Z
Answers.LastActivityDate: 2020-05-18T18:25:45.170Z
Answers.LastEditDate: 2020-05-18T18:25:45.170Z
Answers.UserDisplayName: bitbob
Body: <p>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:</p>
  
  <pre><code>File "/home/paul/bricks/carjulie_bt.nxc" ; line 124
  #   __connectionWrite (1, __DCStopProgramPacket, __D0main)
  #----------------------------------------------------------
  1 errors during compilation
  </code></pre>
  
  <p>This is the relevant portion of the code, what am I missing ?</p>
  
  <pre><code>task main() {
    if (BTConnectToNXT("Sarah", SLAVE_CONN)) {
      RemoteStartProgram(SLAVE_CONN, "carsarah_bt.rxe");
      bool result = RemoteConnectionIdle(SLAVE_CONN);
      if (result) {
        Precedes(ListenToSarah,LookAtColours);
      }
      RemoteStopProgram(SLAVE_CONN);  // This line does not compile ?!
    }
  }
  </code></pre>
  
  <p>Edit 2020-05-16: There is a simple workaround for this error, just send a message to all slaves to execute stopalltasks() function.</p>
  
  <p>This bug is now also on Debian bugs: <a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=960772" rel="nofollow noreferrer">https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=960772</a></p>
  
  <p>EDIT 2020-05-18: SOLVED! This link <a href="https://sourceforge.net/p/bricxcc/code/HEAD/tree/x64/" rel="nofollow noreferrer">https://sourceforge.net/p/bricxcc/code/HEAD/tree/x64/</a> contains a working nbc version for Linux! Thanks!!</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-13T08:50:09.687Z
Comments.Text: According to the [http://bricxcc.sourceforge.net/nbc/nxcdoc/nxcapi/group___comm_module_d_c_functions_gadb8ddf6b9e434b053aac96a304a18f98.html#gadb8ddf6b9e434b053aac96a304a18f98](API 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`)?
Comments.UserDisplayName: zovits
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-13T08:57:54.860Z
Comments.Text: 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...
Comments.UserDisplayName: Paul
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-13T09:02:08.337Z
Comments.Text: BricxCC says "Error Unknown or Invalid Statement".
Comments.UserDisplayName: Paul
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-13T12:08:52.737Z
Comments.Text: This line compiles in the old version 3388 of BricxCC (but there are other breaking issues with this old version).
Comments.UserDisplayName: Paul
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-13T15:04:51.283Z
Comments.Text: What happens if you assign the return value to a variable? 
  
  `result = RemoteStopProgram(SLAVE_CONN)`
Comments.UserDisplayName: David Lechner
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-13T17:47:02.910Z
Comments.Text: Thanks David Lechner, but I have tried that already (just did it again to be sure). The error is the same: `# Error: Unknown or invalid statement
  File "/home/paul/NXT/carjulie_bt.nxc" ; line 149
  #   __connectionWrite (1, __DCStopProgramPacket, __D0main)
  #----------------------------------------------------------
  1 errors during compilation`
Comments.UserDisplayName: Paul
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-14T21:46:15.673Z
Comments.Text: The function may not be defined to the EV3 brick. Is the function defined in another place in the program?
Comments.UserDisplayName: User 119
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-15T10:47:13.790Z
Comments.Text: I am working with NXT bricks, not EV3. As user zovits mentioned, this is a perfectly legal function call.
Comments.UserDisplayName: Paul
Tags: <mindstorms><nxt><nxc>
Title: Mindstorms NXT NXC RemoteStopProgram fails compilation
UserDisplayName: Paul
ThreadText: # Mindstorms NXT NXC RemoteStopProgram fails compilation
  
  (Asked by: username_0 on 2020-05-13)
  
  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/username_0/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) {
        Precedes(ListenToSarah,LookAtColours);
      }
      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!!
  
  **Tags:** mindstorms, nxt, nxc
  
  > **Comments:**
  > **username_1**: According to the [http://bricxcc.sourceforge.net/nbc/nxcdoc/nxcapi/group___comm_module_d_c_functions_gadb8ddf6b9e434b053aac96a304a18f98.html#gadb8ddf6b9e434b053aac96a304a18f98](API 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/username_0/bricks/carjulie_bt.nxc" ; line 124`)?  
  > **username_0**: 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...  
  > **username_0**: BricxCC says "Error Unknown or Invalid Statement".  
  > **username_0**: This line compiles in the old version 3388 of BricxCC (but there are other breaking issues with this old version).  
  > **username_2**: What happens if you assign the return value to a variable?   `result = RemoteStopProgram(SLAVE_CONN)`  
  > **username_0**: Thanks username_2 username_2, but I have tried that already (just did it again to be sure). The error is the same: `# Error: Unknown or invalid statement File "/home/username_0/NXT/carjulie_bt.nxc" ; line 149 #   __connectionWrite (1, __DCStopProgramPacket, __D0main) #---------------------------------------------------------- 1 errors during compilation`  
  > **username_3**: The function may not be defined to the EV3 brick. Is the function defined in another place in the program?  
  > **username_0**: I am working with NXT bricks, not EV3. As user username_1 mentioned, this is a perfectly legal function call.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_4 on 2020-05-15. Score: 2
  
  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.
  
  > **Comments:**
  > **username_0**: Thank you username_4 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.  
  > **username_4**: What version of command line tools are you using?  I see http://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.  
  > **username_4**: Sorry, I spoke too soon -- it looks like https://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 https://sourceforge.net/projects/bricxcc/files/ which doesn't have 1.21r5 files.  
  > **username_4**: However, I did also find https://sourceforge.net/p/bricxcc/code/HEAD/tree/386/ and https://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.  
  
  ---
  
  