Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic VS 2022 not compiling properly for Teensy BUILTIN_SDCARD (Read 204 times)
GTiRhil
Newbies
*
Offline


Posts: 8
Joined: May 19th, 2024
VS 2022 not compiling properly for Teensy BUILTIN_SDCARD
Dec 20th, 2025 at 5:15am
Print Post  
Hi

I have a problem that program loads the wrong SD.h for the Teensy program.  Left to its own devices it loads the standard SD files for Arduino, which do not include the BUILTIN_SDCARD constant.  I force it to go to the correct header and then I still get the wrong SD.cpp code.

Here is the linker error:


ld.exe: Harold.cpp.o: in function setup
Harold.ino:11: undefined reference to SDClass  begin(unsigned char)
 
ld.exe: Harold.cpp.o: in function Print::println(char const*)
Print.h:114: undefined reference to SD
 
collect2.exe*: error: ld returned 1 exit status


Here is the code:

Code (C++)
Select All
#include <Arduino.h>
#include <SD.h>
//#include aries\SD\src\SD.h>

void setup()
{
    while (millis() < 10000) { if (Serial) break; }

    if (!SD.begin(BUILTIN_SDCARD))
    {
        Serial.println("failing SD.begin");
        return;
    }
}

 



Why am I ending up apparently pointing to the wrong library?  I go through the log file and everything seems to be building for a Teensy.  Thanks!
  
Back to top
 
IP Logged
 
GTiRhil
Newbies
*
Offline


Posts: 8
Joined: May 19th, 2024
Re: VS 2022 not compiling properly for Teensy BUILTIN_SDCARD
Reply #1 - Dec 20th, 2025 at 5:21am
Print Post  
I'm sorry but that is not exactly my posting!  I don't know where the aries stuff comes from.  The second include line, not commented out, should be :
#include aries\SD\src\SD.h>
Otherwise it doesn't even find the constant BUILTIN_SDCARD.

Note that in the Arduino IDE 2 it runs fine with the normal SD.h because it recognises that it is building for the Teensy.

Sorry, I don't know why my message got truncated and garbled.
« Last Edit: Dec 22nd, 2025 at 10:31pm by Simon@Visual Micro »  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2830
Joined: Feb 13th, 2019
Re: VS 2022 not compiling properly for Teensy BUILTIN_SDCARD
Reply #2 - Dec 20th, 2025 at 10:09am
Print Post  
Thanks for the report, and we will try to replicate the issue.

A quick workaround in the interim may be to remove (or ZIP and delete the uncompressed version) of the Sketchbook\libraries\SD library so there is no conflict.
« Last Edit: Dec 20th, 2025 at 10:28am by Simon@Visual Micro »  
Back to top
IP Logged
 
GTiRhil
Newbies
*
Offline


Posts: 8
Joined: May 19th, 2024
Re: VS 2022 not compiling properly for Teensy BUILTIN_SDCARD
Reply #3 - Dec 21st, 2025 at 12:51am
Print Post  
In the attached image you can see that without help it is not going to the right SD library at all: the #include failed.

I did send the verbose log before but perhaps it didn't get through.  I'll try again.

I have 14 SD.h files.  I'm gradually renaming them and testing.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
GTiRhil
Newbies
*
Offline


Posts: 8
Joined: May 19th, 2024
Re: VS 2022 not compiling properly for Teensy BUILTIN_SDCARD
Reply #4 - Dec 21st, 2025 at 12:53am
Print Post  
And the log file with build properties b...
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2830
Joined: Feb 13th, 2019
Re: VS 2022 not compiling properly for Teensy BUILTIN_SDCARD
Reply #5 - Dec 22nd, 2025 at 10:28am
Print Post  
Would it be possible to ZIP the entire project and either attach it here or email it to us (excluding the ".vs" folder to save space)?

From your log it never detects any version of the "SD" Library, only the "SDFat" Library which is why the linker is failing from what I can see so far.

You mentioned you have 14 x SD.h files, is this from multiple SD Libraries installed? (either way the log shows no SD library is being found which is odd)
« Last Edit: Dec 22nd, 2025 at 4:29pm by Simon@Visual Micro »  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint