I just got a new laptop and installed the lastest VS Code, which installed my plugins (including PIO) through the sync functionality.
When I attempted to build a project that builds on another computer, I’m getting “error: ‘towlower’ was not declared in this scope”. If I navigate to the offending line and go to the definition of the towlower function it brings me to “wctype.h”.
I’m not sure what the problem is, but being that it builds fine on my other computer, it’s something about the new setup. Could someone help me get to the bottom of this?
Edit: My target is a teensy 3.6
platformio.ini:
board = teensy36
framework = arduino
;//upload options:
upload_protocol = teensy-gui
;upload_protocol = teensy-cli
;upload_protocol = jlink
; change MCU frequency
board_build.f_cpu = 72000000L
I got around this issue by adding #include <wctype.h>
to my include file. I love PIO, but know very little about what’s happening under the hood. Why do you think I had to do that on the new computer / install?
Do you have a verbose compile log from both the working and non-working computer? It could reveal differences such as the teensy platform version.
CLI
pio run -t clean
pio run -v -j1 > compile_log.txt 2>&1
Then upload both compile_log.log
files to e.g. pastebin.com
Thanks for the response @maxgerhardt
I spoke to soon when I said that including wctype.h fixed the issue. It builds, but the program crashes. Changing my platform.ini file to:
[env:teensy36]
platform = teensy@4.12.0
board = teensy36
framework = arduino
upload_protocol = teensy-gui
board_build.f_cpu = 72000000L
platform_packages =
framework-arduinoteensy@1.153.0
toolchain-gccarmnoneeabi@1.50401.190816
Seems to fix the issue and I no longer need to include the wctype.h file to build and run the program without problems.
I’ve uploaded some files onto my google drive.
Old_Computer_No_Problem - contains the compile log and ini file from my old computer.
New_PC_With_Problems - contains the compile log, ini file, and wctype.h file from the new computer.
New_PC_Updated_INI_File - contains the compile log, ini file, and wctype.h file (different) from the new computer after making changes to the ini file that appear to have fixed the problem.
The newer complier / teensycore really reports a lot of warnings that I didn’t get before.
I haven’t been paying attention to the teensy platform releases. After working on this for a little while, I am getting the impression that the problems I am having are probably the result of my “if it ain’t broke, don’t fix it” approach of downloading libraries years ago, storing them as local copies, and using those local copies in my project instead of using the library manager to stay up to date. I was doing a bit of flailing when learning how to build the project in PIO years ago.
I think we can probably close this issue unless have something else you would like me to do.
If platform 4.12.2 works for you, good. That’s
PLATFORM: Teensy (4.12.0) > Teensy 3.6
..
PACKAGES:
- framework-arduinoteensy @ 1.153.0 (1.53)
- toolchain-gccarmnoneeabi @ 1.50401.190816 (5.4.1)
vs
PLATFORM: Teensy (5.0.0) > Teensy 3.6
..
PACKAGES:
- framework-arduinoteensy @ 1.159.0 (1.59)
- toolchain-gccarmnoneeabi-teensy @ 1.110301.0 (11.3.1)
The compile version made a massive leap there in the 5.0 platform. For sure, some incompatibilities with older working code might have been introduced there. But in theory, stuff like towlower
should still be possible there.