Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 

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 and Verbose
  • 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
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
Cannot open Source file "rtos.h", identifier is undefined (Read 1547 times)
rs 77tmp
Junior Member
**
Offline



Posts: 22
Cannot open Source file "rtos.h", identifier is undefined
Apr 22nd, 2022 at 7:11pm
 
I get red squiggly lines under #include "rtos.h"

I also get a red line under
SHTC3 mySHTC3;

The header is included appropriately.

Arduino IDE 2.0 does not show any error.

The code compiles and runs OK - with both Arduino IDE, and Visual Micro

The error list says the variable names are ambiguous. The rtos.h include error - says error active in severity, and cannot open source file (which it obviously does when compiling)

Any ideas?
Back to top
 
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline



Posts: 11487
United Kingdom
Re: Cannot open Source file "rtos.h", identifier is undefined
Reply #1 - Apr 22nd, 2022 at 7:31pm
 
Hi

This is an intellisense issue that can differ for each board. Please post or send the info in the yellow box above so that we can replicate and help resolve.

Thanks

Back to top
 

Tim Leek
home
WWW  
IP Logged
 
rs 77tmp
Junior Member
**
Offline



Posts: 22
Re: Cannot open Source file "rtos.h", identifier is undefined
Reply #2 - Apr 23rd, 2022 at 1:42am
 
Here is the sample code - for Portenta H7 M7 core. If you load it into Visual Studio - you should see #include rtos underlined (the include part), as well as SHTC3 references, and I2C_Mutex calls.

Thanks

Code (C++):
#include "arduino.h"
#include "mbed.h"
#include "rtos.h"
#include "ThreadDebug.h"

// Check we are using GDB Debugging and include the additional code
#ifdef VM_DEBUG_GDB
#include "ThreadDebug.h"
UsbDebugCommInterface  debugComm(&SerialUSB);
ThreadDebug            threadDebug(&debugComm, DEBUG_BREAK_IN_SETUP);
// Set to DEBUG_NO_BREAK_IN_SETUP to prevent automatic stop in setup
#endif

#include "SparkFun_SHTC3.h" // Click here to get the library: http://librarymanager/All#SparkFun_SHTC3
#include <Wire.h>
SHTC3 mySHTC3;              // Declare an instance of the SHTC3 class


using namespace mbed;
using namespace rtos;

Mutex I2C_Mutex;  // Required each time I2C bus will be used

Thread sensorThread;

const int LED_ON = LOW; // Voltage level is inverted
const int LED_OFF = HIGH;



void loop() {
  // put your main code here, to run repeatedly:
  ThisThread::sleep_for(osWaitForever);
}


void task_sensor() {
    int i = 0;
    int j = 0;

    float Temp, RH;

  // Setup I2C port
  // Will need a mutex on I2C



  for (;;) {
   
    I2C_Mutex.lock();
    mySHTC3.update();

    RH = mySHTC3.toPercent();
    Temp = mySHTC3.toDegC();

    //Read SHCT3 sensor in here
//    Serial.print("RH = ");
//    Serial.print(mySHTC3.toPercent());                        // "toPercent" returns the percent humidity as a floating point number
//    Serial.print("%, T = ");
//    Serial.print(mySHTC3.toDegC());                           // "toDegF" and "toDegC" return the temperature as a flaoting point number in deg F and deg C respectively
//    Serial.println(" deg C");





    I2C_Mutex.unlock();



    digitalWrite(LEDR, LED_ON); // Turn green LED on
    ThisThread::sleep_for(1000);
    digitalWrite(LEDR, LED_OFF); // Turn green LED off
    ThisThread::sleep_for(1000);
    ThisThread::sleep_for(10);

    i++;
    j += 2;

  }
}



void setup() {
  // put your setup code here, to run once:

  // Function for device
  //  Modbus Server (slave)
  // Web Server - show only data one way
  // Bluetooth communication with Android / iOS / .NET - for device confguration
  // Sensor Interfaces - multiple I2C sensors read by device
  //    Sensor average data =- 1 minute interval per sensor, and 60 minute interval per sensor
  // LCD panel display to display data - press any sensor and maybe will show a graph  - maybe

  //Serial.begin(115200);

  //Serial.print("Program Start\n");

  Wire.begin();

  mySHTC3.begin();

  pinMode(LEDR, OUTPUT); // Set green LED as output

  delay(5000);

  sensorThread.start(task_sensor);

} 

Back to top
« Last Edit: Apr 23rd, 2022 at 5:40pm by Tim@Visual Micro »  
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline



Posts: 1459
Re: Cannot open Source file "rtos.h", identifier is undefined
Reply #3 - Apr 25th, 2022 at 11:18am
 
Thanks for the detail, we have a fix for this intellisense issue, and will update when this is released for download.
Back to top
 
 
IP Logged
 
rs 77tmp
Junior Member
**
Offline



Posts: 22
Re: Cannot open Source file "rtos.h", identifier is undefined
Reply #4 - Apr 26th, 2022 at 1:06am
 
Thanks
Back to top
 
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline



Posts: 1459
Re: Cannot open Source file "rtos.h", identifier is undefined
Reply #5 - Apr 28th, 2022 at 10:43am
 
The rtos.h issue should be resolved in the latest release 22.04.26-0 which is available from the top of the board below:
https://www.visualmicro.com/forums/YaBB.pl?board=VS_ARDUINO_EXT_RELEASES
Back to top
 
 
IP Logged
 
rs 77tmp
Junior Member
**
Offline



Posts: 22
Re: Cannot open Source file "rtos.h", identifier is undefined
Reply #6 - Apr 30th, 2022 at 11:56pm
 
I downloaded the latest version from the website (04 29 datecode), and the mbed.h and rtos.h are recognized OK, but I get other underlines with using namespace mbed etc

I will attach a screen capture to show them.

It compiles OK.

Thanks
Back to top
« Last Edit: Apr 30th, 2022 at 11:57pm by rs 77tmp »  

Please Register or Login to the Forum to see File Attachments
 
IP Logged
 
rs 77tmp
Junior Member
**
Offline



Posts: 22
Re: Cannot open Source file "rtos.h", identifier is undefined
Reply #7 - May 6th, 2022 at 5:49pm
 
Any update on this one?
Back to top
 
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline



Posts: 1459
Re: Cannot open Source file "rtos.h", identifier is undefined
Reply #8 - May 6th, 2022 at 6:37pm
 
Apologies for the delayed update on this issue, we will release an update in the coming days which should resolve these issues, and we will update this thread when it is available.
Back to top
 
 
IP Logged
 
rs 77tmp
Junior Member
**
Offline



Posts: 22
Re: Cannot open Source file "rtos.h", identifier is undefined
Reply #9 - May 7th, 2022 at 3:46pm
 
Thanks
Back to top
 
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline



Posts: 1459
Re: Cannot open Source file "rtos.h", identifier is undefined
Reply #10 - May 12th, 2022 at 2:08pm
 
The latest release (22.04.29-2) should resolve this issue which is available from the top of the board below:
https://www.visualmicro.com/forums/YaBB.pl?board=VS_ARDUINO_EXT_RELEASES

I have found with some slight modifications to the sketch this all works as expected (see screenshot below)
Back to top
 

Please Register or Login to the Forum to see File Attachments
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print