Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 
When Logging a Support Issue in the Forum, please ensure you have also:-
  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
Support requests without the output above may be impossible to answer, so please help us to help you
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
Serial doesn't work in added empty c and h file (Read 89 times)
andi0000085
Newbies
*
Offline



Posts: 1
Serial doesn't work in added empty c and h file
Oct 27th, 2019 at 9:01pm
 
Hi, I want to split up the functionality in several files. So I added an "empty arduino c and h file" and added a simple Serial.println command in a function. This function I will call in the main.ino file and I always get the error "SerialUSB" undeclared. What do I have to include to get the Serial working?

Thanks

Error:
Code (C++):
test.c: In function printTest

variant.h: 204:37: error: 'SerialUSB' undeclared (first use in this function); did you mean 'SerialGSM'?
   #define Serial                      SerialUSB
test.c:9: note  in expansion of macro Serial
   Serial.println("Hello3")
 


Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Online



Posts: 10565
United Kingdom
Re: Serial doesn't work in added empty c and h file
Reply #1 - Oct 28th, 2019 at 11:30am
 
use .cpp and .h not .c and .h. Ensure you add the #include "Arduino.h" to the code
Back to top
 
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print