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] 2  Send TopicPrint
Very Hot Topic (More than 25 Replies) Problems with intellisense (Read 4598 times)
The_Specialist
Full Member
***
Offline


Posts: 228
Joined: Jul 1st, 2020
Problems with intellisense
Oct 13th, 2022 at 8:07pm
Print Post  
This code

int main()
{
    const char* user = "me";
    const char* pwd = "me";
    uint8_t auth = strlen(user) + strlen(pwd);
char toEncode[auth + 4];
}

is running in the https://www.onlinegdb.com/online_c++_compiler

but In my code I the expresion must be a const value, so the size need to be a constant value.

Using Vs2017... How can I find what compiler is in use? 

I see that C++ is loaded when I start a new project, But many librarys I use are using also C. can find that tag when I start a new project.
« Last Edit: Oct 13th, 2022 at 8:07pm by The_Specialist »  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2704
Joined: Feb 13th, 2019
Re: Problems with intellisense
Reply #1 - Oct 13th, 2022 at 8:10pm
Print Post  
Can you enable the options shown at the top of the page and perform a build for your project in Visual Micro, and attach the output so we can investigate further.
  
Back to top
IP Logged
 
The_Specialist
Full Member
***
Offline


Posts: 228
Joined: Jul 1st, 2020
Re: Problems with intellisense
Reply #2 - Oct 13th, 2022 at 8:12pm
Print Post  
This is also in one of my libs

#pragma once
#pragma GCC optimize ("Ofast")

GCC can not be found...
  
Back to top
 
IP Logged
 
The_Specialist
Full Member
***
Offline


Posts: 228
Joined: Jul 1st, 2020
Re: Problems with intellisense
Reply #3 - Oct 13th, 2022 at 8:21pm
Print Post  
build
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
The_Specialist
Full Member
***
Offline


Posts: 228
Joined: Jul 1st, 2020
Re: Problems with intellisense
Reply #4 - Oct 13th, 2022 at 8:39pm
Print Post  
Sorry, I gave you the complete build. This build is only for... 

// the setup function runs once when you press reset or power the board
void setup() {

}

// the loop function runs over and over again until power down or reset
void loop() {
    const char* user = "me";
    const char* pwd = "me";
    uint8_t auth = strlen(user) + strlen(pwd);
    char toEncode[auth + 4];
}
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
The_Specialist
Full Member
***
Offline


Posts: 228
Joined: Jul 1st, 2020
Re: Problems with intellisense
Reply #5 - Oct 13th, 2022 at 9:44pm
Print Post  
I think I found the problem in the verbose log.

intellisense.tools.path={compiler.toolchain.path}
\5.2.0\bits;{vm.intellisense.add-paths}

it seem to find xtensa-esp32-elf 5.2.0

But in my folder I find 
esp32\tools\xtensa-esp32-elf-gcc\gcc8_4_0-esp-2021r2-patch3

I think it doesn't see the patch and only see the folder

gcc8_4_0-esp-2021r2-patch3\xtensa-esp32-elf
  
Back to top
 
IP Logged
 
The_Specialist
Full Member
***
Offline


Posts: 228
Joined: Jul 1st, 2020
Re: Problems with intellisense
Reply #6 - Oct 13th, 2022 at 9:56pm
Print Post  
This I don't understand. In options->visual micro-> intellisense I see...

allowcompilerstringdefines         True
always re-add header                false
LangC11                                   true
LangCpp17                               true

I have a C++20 installed. Why can I don't use that one? I have to say that I have also Clang compiler installed.

I changed the LangC11 to false and now it's using the patch

sp-2021r2-patch3
15\packages\esp32\tools\xtensa-esp32-elf-gcc\gcc8_4_0-esp-2021r2-patch3
-esp-2021r2-patch3
no15\packages\esp32\tools\xtensa-esp32s2-elf-gcc\gcc8_4_0-esp-2021r2-patch3
_4_0-esp-2021r2-patch3
_4_0-esp-2021r2-patch3

still having that error strlen in the size of an array and using definitions like this

PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0_CLK_OUT1);
« Last Edit: Oct 13th, 2022 at 10:06pm by The_Specialist »  
Back to top
 
IP Logged
 
The_Specialist
Full Member
***
Offline


Posts: 228
Joined: Jul 1st, 2020
Re: Problems with intellisense
Reply #7 - Oct 14th, 2022 at 8:36am
Print Post  
I rebooted my system in the morning and it directing again to the 5.2.0

th}\xtensa-esp32-elf\include;

It's not the first time I having this issue. It allways happens when I programming Filesystems like FS.h and SdFat.h.

Just before intellisense started to fail, I had this issue and I was trying to solve . it start evrytime by changing the typedef in the SdFat for finding the right filetype for the drive and file to make it all work together.

Something else happend before... I had to import and delete libs. The compiler does see the library, but doesn't see the conflict anymore between two libraries, because it was deleted in the code, but still been seen when compiling.

I had imported webserver.h and FS.h for esp32, but FS.h and SDfat.h easily doesn't work together and gave me an error.  When I delete FS.h in the code, it was no problem for the compiler anymore? Still it was needed for the webserver.h lib, because it is still included in that lib.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2704
Joined: Feb 13th, 2019
Re: Problems with intellisense
Reply #8 - Oct 14th, 2022 at 9:02am
Print Post  
Thanks for the reports, we are looking into the intellisense issues and paths, and we will update when we have clarity.

We will be updating to a newer Intellisense system in the near future which will improve its understanding of the embedded toolchains, but this is not available at present.

For the filesystem header issues, does this only present as an intellisense issue, and can you provide an example?
  
Back to top
IP Logged
 
The_Specialist
Full Member
***
Offline


Posts: 228
Joined: Jul 1st, 2020
Re: Problems with intellisense
Reply #9 - Oct 14th, 2022 at 10:23am
Print Post  
A simple example I can not give you. Note that I imported the librarys as an "create shared projects when included librarys" in one visual studio that was open. But I had two times visual studio open with an other project. In that visual studio I have imported the library without check marks in "add library. I was switching between those two. Because I saw that something was wrong before it stops working. When I start a new project it doesn't find the right toolchains anymore. So I can not help you anymore. I am sorry.

I was working in a class in a lib that inherited to the lib SdFat.h. the languages are C and C++. I can not give you a simple shetch because it happens after days trying to make it work, where I worked over a year now. It contains thousands of lines. But where it starts to fail was in adjusting the filesystem in here [https://github.com/schreibfaul1/ESP32-audioI2S][classe fs]
I had it with an other lib that also was using SdFat.h by a class on top of it. So it's not the lib that is the problem. I really think that it's the has to do with namespaces, definitions and filetypes in lib that are using filesystem libs. This is the classe what I was adapting. I commented the  definitions and namespaces before.

Code (C++)
Select All
#ifdef SDFATFS_USED
#include <SdFat.h>  // https://github.com/greiman/SdFat
#else
#include <SD.h>
#include <SD_MMC.h>
#include <SPIFFS.h>
#include <FS.h>
#include <FFat.h>
#endif // SDFATFS_USED


#ifdef SDFATFS_USED
//typedef File32 File;
typedef FsFile File;

namespace fs {
    class FS : public SdFat {
    public:
        bool begin(SdCsPin_t csPin = SS, uint32_t maxSck = SD_SCK_MHZ(25)) { return SdFat::begin(csPin, maxSck); }
    };

    class SDFATFS : public fs::FS {
    public:
        // sdcard_type_t cardType();
        uint64_t cardSize() {
            return totalBytes();
        }
        uint64_t usedBytes() {
            // set SdFatConfig MAINTAIN_FREE_CLUSTER_COUNT non-zero. Then only the first call will take time.
            return (uint64_t)(clusterCount() - freeClusterCount()) * (uint64_t)bytesPerCluster();
        }
        uint64_t totalBytes() {
            return (uint64_t)clusterCount() * (uint64_t)bytesPerCluster();
        }
    };
}

extern fs::SDFATFS SD_SDFAT;

using namespace fs;
#define SD SD_SDFAT
#endif //SDFATFS_USED 




offcoarse the filetype/namespace/lib is also been used in the cpp. 

This is the code I was adjusting in my shetch.


Code (C++)
Select All
#define SPI_SPEED SD_SCK_MHZ(4)
SPIClass Myspi(VSPI);

void SDconfig() {
#ifdef SDFATFS_USED
    if (!SD.begin(SD_CS, SPI_SPEED)) {
        if (SD.card()->errorCode()) {
            Serial.println("SD initialization failed.");
        }
        else if (SD.vol()->fatType() == 0) {
            Serial.println("Can't find a valid FAT16/FAT32 partition.");
        }
        else {
            Serial.println("Can't determine error type");
        }
        return;
    }

#else
    //pinMode(SD_CS, OUTPUT);//SS pin not set as output in the spi library(sd card reader)//zit in sd.h library
    //pinMode(MISO, INPUT_PULLUP);//miso needs a pullup (sd card reader)
    //digitalWrite(SD_CS, HIGH);//zit in sd.h library
    //Myspi.begin(SCK, MISO, MOSI, SD_CS);
    //SPI.setFrequency(1000000);
    //Myspi.setFrequency(4000000);
   // SD.begin(SD_CS, Myspi);
    if (!SD.begin(SD_CS)) {
        Serial.println("SD card error!");
        //sd32.initErrorHalt(&Serial);
        while (true) {
            delay(1000);
        }
    }
    // print the type of card
    Serial.println();
    Serial.print("Card type:         ");

    switch (SD.cardType()) {
    case CARD_NONE:
        Serial.println("NONE");
        break;
    case CARD_MMC:
        Serial.println("MMC");
        break;
    case CARD_SD:
        Serial.println("SD");
        break;
    case CARD_SDHC:
        Serial.println("SDHC");
        break;
    default:
        Serial.println("Unknown");
    }

    Serial.print("Card size:  ");
    Serial.println((float)SD.cardSize() / 1000);

    Serial.print("Total bytes: ");
    Serial.println(SD.totalBytes());

    Serial.print("Used bytes: ");
    Serial.println(SD.usedBytes());
#endif 



I hope you are something with it. Let me know if you have some questions.

Oh I forgot something. I was also adjusting this...

Code (C++)
Select All
#if SDFAT_FILE_TYPE == 1
/** Select type for SdFat. */
typedef SdFat32 SdFat;
/** Select type for SdBaseFile. */
typedef FatFile SdBaseFile;
#elif SDFAT_FILE_TYPE == 2
typedef SdExFat SdFat;
typedef ExFatFile SdBaseFile;
#elif SDFAT_FILE_TYPE == 3
typedef SdFs SdFat;
typedef FsBaseFile SdBaseFile;
#else  // SDFAT_FILE_TYPE
#error Invalid SDFAT_FILE_TYPE
#endif  // SDFAT_FILE_TYPE
//
// Only define File if FS.h is not included.
// Line with test for __has_include must not have operators or parentheses.
#if defined __has_include
#if __has_include(<FS.h>)
#define HAS_INCLUDE_FS_H
#warning File not defined because __has__include(FS.h)
#endif  // __has_include(<FS.h>)
#endif  // defined __has_include
#ifndef HAS_INCLUDE_FS_H
#if SDFAT_FILE_TYPE == 1
/** Select type for File. */
typedef File32 File;
#elif SDFAT_FILE_TYPE == 2
typedef ExFile File;
#elif SDFAT_FILE_TYPE == 3
typedef FsFile File;
#endif  // SDFAT_FILE_TYPE
#endif  // HAS_INCLUDE_FS_H 



In SdFat.h

And this in SdFatConfig.h

Code (C++)
Select All
#ifndef SDFAT_FILE_TYPE
#if defined(__AVR__) && FLASHEND < 0X8000
// 32K AVR boards.
#define SDFAT_FILE_TYPE 1
#elif defined(__arm__)
// ARM boards usually have plenty of memory
#define SDFAT_FILE_TYPE 1
#else  // defined(__AVR__) && FLASHEND < 0X8000
// All other boards.
#define SDFAT_FILE_TYPE 1
#endif  // defined(__AVR__) && FLASHEND < 0X8000
#endif  // SDFAT_FILE_TYPE 



voila!
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2704
Joined: Feb 13th, 2019
Re: Problems with intellisense
Reply #10 - Oct 14th, 2022 at 11:02am
Print Post  
Off-Topic replies have been moved to this Topic.
  
Back to top
IP Logged
 
The_Specialist
Full Member
***
Offline


Posts: 228
Joined: Jul 1st, 2020
Re: Problems with intellisense
Reply #11 - Oct 17th, 2022 at 5:53am
Print Post  
A time a go I got some problems with the byte variable, that was ambiguous. I replaced it with unsigned int t and it worked. I don't know how I can find where it is ambiguous with... To bad, because the information is in it.

I found this documentation about intellisense

https://www.visualmicro.com/page/Extending-Visual-Studio-Intellisense.aspx

if I want to include the intellisense lib it doesn't find it. And when I add this code to my sketch

#if defined(_VMICRO_INTELLISENSE)
typedef unsigned char uint8_t;
#endif

it recognize the _VMICRO_INTELLISENSE, but I can not open the location.

Because of those problems with byte, I tried to change the project->properties->config->general
1/platform toolset
2/C++ languages
3/C language standaard

Maybe that is also the reason why it got worse...

I read about someone had the same problems than I do. He didn't use filesystem. But he was telling he had also a big program size.
« Last Edit: Oct 17th, 2022 at 6:03am by The_Specialist »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
The_Specialist
Full Member
***
Offline


Posts: 228
Joined: Jul 1st, 2020
Re: Problems with intellisense
Reply #12 - Oct 17th, 2022 at 6:11am
Print Post  
In the solution properties -> debug source files it referring to

G:\Software\install\Visual Studio 2019\VC\Tools\MSVC\14.29.30133\include\... 
G:\Software\install\Visual Studio 2019\VC\Tools\MSVC\14.29.30133\crt\... 
G:\Software\install\Visual Studio 2019\VC\Tools\MSVC\14.29.30133\iatmfc\... 

In this windows documentation it's the "Windows Kits" for C++

https://learn.microsoft.com/en-us/visualstudio/ide/visual-cpp-intellisense?view=...

Don't know about visual micro...
« Last Edit: Oct 17th, 2022 at 6:45am by The_Specialist »  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2704
Joined: Feb 13th, 2019
Re: Problems with intellisense
Reply #13 - Oct 17th, 2022 at 11:04am
Print Post  
The issue with the uint8_t does not manifest in the latest Visual Micro forum release (22.09.05.11) that I can see, can you upgrade and see if this helps with some of these issues?

It can be downloaded from the top of the below page:
https://www.visualmicro.com/forums/YaBB.pl?board=VS_ARDUINO_EXT_RELEASES

  
Back to top
IP Logged
 
The_Specialist
Full Member
***
Offline


Posts: 228
Joined: Jul 1st, 2020
Re: Problems with intellisense
Reply #14 - Oct 17th, 2022 at 12:19pm
Print Post  
It sees more issues now

expected an expression
expression must have a const value
no instance of function template "std==isalnum (and isalpha,toupper,isspace) matches the argument list
no instance of overloaded function 'min' matches the argument list

my shetch doesn't have a problem anymore with the definition of WIFI_INIT_CONFIG_DEFAULT(); so that's a good thing. And yes the issue with the byte is solved.

What is the minimum requirement to install in visual studio under the tab individual components for an ESP32 on a 64bit system? I know the default is desktop development with C++ on the tab workloads. But it didn't work for me.

  • compiler, build tools and runtimes

  • SDK libraries and frameworks


May I ask to please describe the exact names you have installed under those titles please?
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
The_Specialist
Full Member
***
Offline


Posts: 228
Joined: Jul 1st, 2020
Re: Problems with intellisense
Reply #15 - Oct 17th, 2022 at 12:26pm
Print Post  
This is probably just a note... it says vs2022.
  

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


Posts: 2704
Joined: Feb 13th, 2019
Re: Problems with intellisense
Reply #16 - Oct 17th, 2022 at 12:50pm
Print Post  
Thanks for the update, we will try to improve the intellisense issues, however we are working on an improved intellisense system and we will let you know when this is available for download.

The only component required in Visual Studio to run Visual Micro is the C++ for Desktop development.  This will change when the updated system is released, which will be detailed when it is available.

Some of the issues with the current systems intellisense are due to it using the MSVC compiler to parse the files provided in the board package, which it does not always understand or expand enough of the macros to work fully.  The new system will change this to use the compiler used in the build process (from the board package) which should massively improve the issues.
  
Back to top
IP Logged
 
The_Specialist
Full Member
***
Offline


Posts: 228
Joined: Jul 1st, 2020
Re: Problems with intellisense
Reply #17 - Oct 17th, 2022 at 2:20pm
Print Post  
Sounds good. I have a ton of those compilers installed. Don't forget... if Arduino-esp32 SDK is installed from GitHub for collaborators, it need to be install in to the Arduino project folder under hardware ...\Arduino\espressif\esp32. But I think you already know that.
  
Back to top
 
IP Logged
 
The_Specialist
Full Member
***
Offline


Posts: 228
Joined: Jul 1st, 2020
Re: Problems with intellisense
Reply #18 - Oct 17th, 2022 at 5:58pm
Print Post  
For now I installed it from the board manager from the Arduino IDE.
  
Back to top
 
IP Logged
 
The_Specialist
Full Member
***
Offline


Posts: 228
Joined: Jul 1st, 2020
Re: Problems with intellisense
Reply #19 - Oct 17th, 2022 at 9:02pm
Print Post  
Arduino-esp contains multiple languages. C for esp-IDF and some libraries are even pre-build like the LWIP adapter in Linux and used as a component in to ESP-IDF and again been used as a component in to arduino ESP32 (C++). See my topic from some time ago about the question how to make changes in the LWIP adapter.

Linux->C->C++

https://github.com/espressif/arduino-esp32/issues/6713
« Last Edit: Oct 17th, 2022 at 9:04pm by The_Specialist »  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint