12:26 am
January 28, 2017
Hello,
Brand new here. I have used labview for many years buy just stumbled upon this site earlier this week and was really interested in trying LabVIEW with some physical hardware. I'm using an RFduino (not officially supported, I know). I mocked up a simple example reading and writing bytes via serial port. Everything works fine if I use the Serial Write Bytes VI, but the compiler gives me the following error when trying to use the Serial Write String VI:
temp:58: error: 'class String' has no member named 'c_str'
_Serial[Node825Out]->write((unsigned char*)Const326.c_str(), Const326.length());
^
exit status 1
'class String' has no member named 'c_str'
I can wire a string constant to a String to Byte Array then to the Serial Write Bytes. That compiles, loads, and runs as expected, so it's not something to do with simply having string data on the block diagram. Since the string write obviously works with lots of other boards, is this an issue to do specifically with my hardware and configuration?
As mentioned, I've worked with LabVIEW for years, but my debugging of text based languages and similar looking errors is very deficient (which is why I'm using LabVIEW, right??). So if there's something related to the RFduino libraries or whatnot, I'm never going to solve it. Rather than simply avoiding the string write function with this hardware, figured I might try to learn something. Thanks for any help
12:58 am
January 28, 2017
Well I managed to kind of answer my own question.. i.e. I was able to get it to work but without real understanding. I found the string class in one of the library files for my board and replaced every instance of "cstr" with "c_str". After that, my simple example compiles fine, but I suspect I'm going to have lots of similar type situations since compiling something nearly as simple like the 'Serial - Monitoring GUI - Arduino Target' VI gives a bunch of other errors.
1:27 am
March 12, 2015
The issue you are having is that you are using unsupported hardware which likely uses its own set of libraries for particular functions. Here it looks like the String library is a little different, or non-standard from the Arduino String library. Take a look here. The Arduino Compatible Compiler for LabVIEW highly depends on some of the core Arduino libraries, including this StringObject library. This is the WString library located at \Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino. If your hardware is using some custom variant of this or other core libraries, then the ACC4LV will not compile code correctly and what you will see is the compiler errors returned from the Arduino C compiler. This gives you a hint of what is going on as you found out, and you were able to resolve for c_str(). If you want to use unsupported hardware, you will have to dig through these libraries to see if you can resolve the issues by changing the libraries. Otherwise you can refer to the product documentation for a list of boards that have been tested with the Compiler.
1:47 am
January 28, 2017
That was the conclusion I was coming too. I happened to be at the store yesterday and just went with one of the cheapest options to see if I could get something to do something without too much trouble, which I'd rate as a success so far. With that said, now I'm going to choose a supported board or maybe the PWS from here.
Thanks for your advice!
39
1 Guest(s)