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) [Intellisense Error]Visual Studio 2019 Intellisense and namespaces (Read 8570 times)
Bambo
Member
***
Offline


Posts: 146
Location: Liverpool, UK
Joined: Jan 13th, 2020
[Intellisense Error]Visual Studio 2019 Intellisense and namespaces
Feb 2nd, 2020 at 2:57pm
Print Post  
hi,

i have a project folder structure like this:

project/app.ino
project/mylib/include/a - adds the A namespace
project/mylib/include/a/a - adds the AA namespace
project/mylib/include/a/b - adds the AB namespace

But when i try to include the AA namespaced functions from within the AB namespaced functions, red squiggles appear in the visual studio environment but it compiles fine?


- edit -
I am using the Nucleo-64 STM32L452RE  settings and the namespaces aren't working, however, if i switch to Uno (https://www.visualmicro.com/forums/YaBB.pl?num=1402500470/6) then the red squiggles go away. But then when i change the project board back to Nucleo-64, the red squiggles appear again.

- edit -
If i switch to the Uno board it no longer compiles but prints this error:
Quote:
Y.h: 10:10: fatal error: Y/include/Error_Source.h: No such file or directory
   #include "Y/include/Error_Source.h"
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   compilation terminated



     An error was encountered during the 'Deep Search' library discovery process.
Debug build failed for project 'X'


- edit -
If i remove the "Deep Search" feature then it compiles and intellisense works when using the Uno board.

But when i change it to Nucleo-64, the red squiggles appear and when Deep Search is disabled, these errors appear (these errors do not appear when deep search is enabled):
Quote:

# Coping cached core 1a14a\core.a to C:\Users\Richa\AppData\Local\Temp\VMBuilds\SAIN\STM32_Nucleo_64\Debug\core.a

-- removed
 
ld.exe: rtup_stm32yyxx.S.o): in function LoopFillZerobss
(.text.Reset_Handler+0x2a)*: undefined reference to SystemInit
 
ld.exe: ing_time.c.o): in function millis
wiring_time.c*: (.text.millis+0x0): undefined reference to getCurrentMillis
 
ld.exe: ing_time.c.o): in function delay
wiring_time.c*: (.text.delay+0x6): undefined reference to getCurrentMillis
ld.exe: wiring_time.c:(.text.delay+0x10): undefined reference to getCurrentMillis
 
ld.exe: dwareSerial.cpp.o): in function HardwareSerial::_rx_complete_irq(serial_s*)

Error linking for board Nucleo-64
HardwareSerial.cpp*: (.text._ZN14HardwareSerial16_rx_complete_irqEP8serial_s+0x8): undefined reference to uart_getc
 
ld.exe: dwareSerial.cpp.o): in function HardwareSerial::write(unsigned char)
Debug build failed for project 'SAIN'
HardwareSerial.cpp*: (.text._ZN14HardwareSerial5writeEh+0x24): undefined reference to uart_enable_tx
ld.exe: HardwareSerial.cpp:(.text._ZN14HardwareSerial5writeEh+0x48): undefined reference to serial_tx_active
ld.exe: HardwareSerial.cpp:(.text._ZN14HardwareSerial5writeEh+0x52): undefined reference to uart_attach_tx_callback
 
ld.exe: dwareSerial.cpp.o): in function HardwareSerial::HardwareSerial(void*, bool)
HardwareSerial.cpp*: (.text._ZN14HardwareSerialC2EPvb+0x50): undefined reference to pinmap_pin
ld.exe: HardwareSerial.cpp:(.text._ZN14HardwareSerialC2EPvb+0x5c): undefined reference to pinmap_pin
 
ld.exe: dwareSerial.cpp.o): in function HardwareSerial::enableHalfDuplexRx()
HardwareSerial.cpp*: (.text._ZN14HardwareSerial18enableHalfDuplexRxEv+0x26): undefined reference to uart_enable_rx
 
ld.exe: dwareSerial.cpp.o): in function HardwareSerial::begin(unsigned long, unsigned char)
HardwareSerial.cpp*: (.text._ZN14HardwareSerial5beginEmh+0x60): undefined reference to uart_init
ld.exe: HardwareSerial.cpp:(.text._ZN14HardwareSerial5beginEmh+0x8c): undefined reference to _Error_Handler
ld.exe: HardwareSerial.cpp:(.text._ZN14HardwareSerial5beginEmh+0x74): undefined reference to uart_attach_rx_callback
 
ld.exe: n.cpp.o): in function premain()
main.cpp*: (.text.startup._Z7premainv+0x4): undefined reference to HAL_NVIC_SetPriorityGrouping
 
ld.exe: rd.c.o): in function init
board.c*: (.text.init+0x0): undefined reference to hw_config_init
 
collect2.exe*: error: ld returned 1 exit status



« Last Edit: Feb 2nd, 2020 at 3:45pm by Bambo »  

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


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: [Intellisense Error]Visual Studio 2019 Intellisense and namespaces
Reply #1 - Feb 2nd, 2020 at 4:06pm
Print Post  
Arduino only supports code in project folder,  project\src folder and sub folders of src

  
Back to top
IP Logged
 
Bambo
Member
***
Offline


Posts: 146
Location: Liverpool, UK
Joined: Jan 13th, 2020
Re: [Intellisense Error]Visual Studio 2019 Intellisense and namespaces
Reply #2 - Feb 2nd, 2020 at 4:18pm
Print Post  
Tim@Visual Micro wrote on Feb 2nd, 2020 at 4:06pm:
Arduino only supports code in project folder,  project\src folder and sub folders of src



Ok i will move my folders into an /src/ folder and return with results.
  
Back to top
 
IP Logged
 
Bambo
Member
***
Offline


Posts: 146
Location: Liverpool, UK
Joined: Jan 13th, 2020
Re: [Intellisense Error]Visual Studio 2019 Intellisense and namespaces
Reply #3 - Feb 2nd, 2020 at 4:29pm
Print Post  
Ok my project structure is now like this:

project/app.ino
project/src/myliba.h
project/src/liba/include/filea.h
project/src/liba/src/filea.cpp

But when i compile, it returns with this:


" Quote:

ld.exe: rtup_stm32yyxx.S.o): in function LoopFillZerobss
(.text.Reset_Handler+0x2a)*: undefined reference to SystemInit
 
ld.exe: ing_time.c.o): in function millis
wiring_time.c*: (.text.millis+0x0): undefined reference to getCurrentMillis
 
ld.exe: ing_time.c.o): in function delay
wiring_time.c*: (.text.delay+0x6): undefined reference to getCurrentMillis
ld.exe: wiring_time.c:(.text.delay+0x10): undefined reference to getCurrentMillis
 
ld.exe: dwareSerial.cpp.o): in function HardwareSerial::_rx_complete_irq(serial_s*)

Error linking for board Nucleo-64
HardwareSerial.cpp*: (.text._ZN14HardwareSerial16_rx_complete_irqEP8serial_s+0x8): undefined reference to uart_getc
Debug build failed for project 'SAIN'
 
ld.exe: dwareSerial.cpp.o): in function HardwareSerial::write(unsigned char)
HardwareSerial.cpp*: (.text._ZN14HardwareSerial5writeEh+0x24): undefined reference to uart_enable_tx
ld.exe: HardwareSerial.cpp:(.text._ZN14HardwareSerial5writeEh+0x48): undefined reference to serial_tx_active
ld.exe: HardwareSerial.cpp:(.text._ZN14HardwareSerial5writeEh+0x52): undefined reference to uart_attach_tx_callback
 
ld.exe: dwareSerial.cpp.o): in function HardwareSerial::HardwareSerial(void*, bool)
HardwareSerial.cpp*: (.text._ZN14HardwareSerialC2EPvb+0x50): undefined reference to pinmap_pin
ld.exe: HardwareSerial.cpp:(.text._ZN14HardwareSerialC2EPvb+0x5c): undefined reference to pinmap_pin
 
ld.exe: dwareSerial.cpp.o): in function HardwareSerial::enableHalfDuplexRx()
HardwareSerial.cpp*: (.text._ZN14HardwareSerial18enableHalfDuplexRxEv+0x26): undefined reference to uart_enable_rx
 
ld.exe: dwareSerial.cpp.o): in function HardwareSerial::begin(unsigned long, unsigned char)
HardwareSerial.cpp*: (.text._ZN14HardwareSerial5beginEmh+0x60): undefined reference to uart_init
ld.exe: HardwareSerial.cpp:(.text._ZN14HardwareSerial5beginEmh+0x8c): undefined reference to _Error_Handler
ld.exe: HardwareSerial.cpp:(.text._ZN14HardwareSerial5beginEmh+0x74): undefined reference to uart_attach_rx_callback
 
ld.exe: n.cpp.o): in function premain()
main.cpp*: (.text.startup._Z7premainv+0x4): undefined reference to HAL_NVIC_SetPriorityGrouping
 
ld.exe: rd.c.o): in function init
board.c*: (.text.init+0x0): undefined reference to hw_config_init
 
collect2.exe*: error: ld returned 1 exit status



- edit -


It will compile when "Deep Search" is enabled, but the intellisense does not work the the Nucle-64 board for some weird reason (even if deep search is enabled)
« Last Edit: Feb 2nd, 2020 at 4:34pm by Bambo »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: [Intellisense Error]Visual Studio 2019 Intellisense and namespaces
Reply #4 - Feb 2nd, 2020 at 4:35pm
Print Post  
Dies it compile in the Arduino IDE?
  
Back to top
IP Logged
 
Bambo
Member
***
Offline


Posts: 146
Location: Liverpool, UK
Joined: Jan 13th, 2020
Re: [Intellisense Error]Visual Studio 2019 Intellisense and namespaces
Reply #5 - Feb 2nd, 2020 at 4:39pm
Print Post  
Tim@Visual Micro wrote on Feb 2nd, 2020 at 4:35pm:
Dies it compile in the Arduino IDE?


No it throws this error
Quote:

In file included from C:\Users\Richa\Documents\GitHub\x\Software\SAIN\SAIN.ino:1:0:


G.h:10:10: fatal error: src/JIG/include/Error_Source.h: No such file or directory

#include "src/JIG/include/Error_Source.h"

          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Uno.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: [Intellisense Error]Visual Studio 2019 Intellisense and namespaces
Reply #6 - Feb 2nd, 2020 at 4:52pm
Print Post  
Looks like a missing source code file relating to an #include. 

Let's see the info requested in yellow above so we can see why the error message is different in Visual Micro. Maybe the deep search is switched off which might mean we would hit closer to the linker stage instead of early on during #include discovery. However, I don't my request will help solved the issue other than to remove the confusion between the different errors.
  
Back to top
IP Logged
 
Bambo
Member
***
Offline


Posts: 146
Location: Liverpool, UK
Joined: Jan 13th, 2020
Re: [Intellisense Error]Visual Studio 2019 Intellisense and namespaces
Reply #7 - Feb 2nd, 2020 at 4:55pm
Print Post  
Tim@Visual Micro wrote on Feb 2nd, 2020 at 4:52pm:
Looks like a missing source code file relating to an #include. 

Let's see the info requested in yellow above so we can see why the error message is different in Visual Micro. Maybe the deep search is switched off which might mean we would hit closer to the linker stage instead of early on during #include discovery. However, I don't my request will help solved the issue other than to remove the confusion between the different errors.


Ok, i need to change my files to be relative to the directory then i will post the results.

I'm currently changing the include guards but the red squiggles are still showing even though they shouldn't
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: [Intellisense Error]Visual Studio 2019 Intellisense and namespaces
Reply #8 - Feb 2nd, 2020 at 5:00pm
Print Post  
Yes the build happens in a hidden temp folder with a copy of the project files. VS should not show squiggles under includes if the files are included in the project normally. Setup a simple test in a new folder and email to the address in yellow above if you can replicate. Include the solution and project (all files) etc in the zip.

« Last Edit: Feb 2nd, 2020 at 5:01pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Bambo
Member
***
Offline


Posts: 146
Location: Liverpool, UK
Joined: Jan 13th, 2020
Re: [Intellisense Error]Visual Studio 2019 Intellisense and namespaces
Reply #9 - Feb 2nd, 2020 at 5:24pm
Print Post  
Ok here's the result.

When i compile it using the Uno board, it compiles fine.

When i compile it with arduino or visual micro and targetting the STM32 L452RE board, it doesn't compile? But visual micro build returns these errors.


Quote:
Linking it all together ...
# Coping cached core 1a14a\core.a to C:\Users\Richa\AppData\Local\Temp\VMBuilds\SAIN\STM32_Nucleo_64\Debug\core.a

-gcc\9.2.1-1.1/bin/arm-none-eabi-gcc" -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -Os --specs=nano.specs -Wl,--defsym=LD_FLASH_OFFSET=0 -Wl,--defsym=LD_MAX_SIZE=524288 -Wl,--defsym=LD_MAX_DATA_SIZE=163840 -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common riants\NUCLEO_L452RE/ldscript.ld" SAIN.ino.map" /DSP/Lib/GCC/" -larm_cortexM4lf_math -o elf"
 
ld.exe: rtup_stm32yyxx.S.o): in function LoopFillZerobss
(.text.Reset_Handler+0x2a)*: undefined reference to SystemInit
 
ld.exe: ing_time.c.o): in function millis
wiring_time.c*: (.text.millis+0x0): undefined reference to getCurrentMillis
 
ld.exe: ing_time.c.o): in function delay
wiring_time.c*: (.text.delay+0x6): undefined reference to getCurrentMillis
ld.exe: wiring_time.c:(.text.delay+0x10): undefined reference to getCurrentMillis
 
ld.exe: dwareSerial.cpp.o): in function HardwareSerial::_rx_complete_irq(serial_s*)

Error linking for board Nucleo-64
Debug build failed for project 'SAIN'
HardwareSerial.cpp*: (.text._ZN14HardwareSerial16_rx_complete_irqEP8serial_s+0x8): undefined reference to uart_getc
 
ld.exe: dwareSerial.cpp.o): in function HardwareSerial::write(unsigned char)
HardwareSerial.cpp*: (.text._ZN14HardwareSerial5writeEh+0x24): undefined reference to uart_enable_tx
ld.exe: HardwareSerial.cpp:(.text._ZN14HardwareSerial5writeEh+0x48): undefined reference to serial_tx_active
ld.exe: HardwareSerial.cpp:(.text._ZN14HardwareSerial5writeEh+0x52): undefined reference to uart_attach_tx_callback
 
ld.exe: dwareSerial.cpp.o): in function HardwareSerial::HardwareSerial(void*, bool)
HardwareSerial.cpp*: (.text._ZN14HardwareSerialC2EPvb+0x50): undefined reference to pinmap_pin
ld.exe: HardwareSerial.cpp:(.text._ZN14HardwareSerialC2EPvb+0x5c): undefined reference to pinmap_pin
 
ld.exe: dwareSerial.cpp.o): in function HardwareSerial::enableHalfDuplexRx()
HardwareSerial.cpp*: (.text._ZN14HardwareSerial18enableHalfDuplexRxEv+0x26): undefined reference to uart_enable_rx
 
ld.exe: dwareSerial.cpp.o): in function HardwareSerial::begin(unsigned long, unsigned char)
HardwareSerial.cpp*: (.text._ZN14HardwareSerial5beginEmh+0x60): undefined reference to uart_init
ld.exe: HardwareSerial.cpp:(.text._ZN14HardwareSerial5beginEmh+0x8c): undefined reference to _Error_Handler
ld.exe: HardwareSerial.cpp:(.text._ZN14HardwareSerial5beginEmh+0x74): undefined reference to uart_attach_rx_callback
 
ld.exe: n.cpp.o): in function premain()
main.cpp*: (.text.startup._Z7premainv+0x4): undefined reference to HAL_NVIC_SetPriorityGrouping
 
ld.exe: rd.c.o): in function init
board.c*: (.text.init+0x0): undefined reference to hw_config_init
 
collect2.exe*: error: ld returned 1 exit status


if i compile using arduino ide with warnings turned off, this is the errors during linking.

https://pastebin.com/dxmWQDz5
  
Back to top
 
IP Logged
 
Bambo
Member
***
Offline


Posts: 146
Location: Liverpool, UK
Joined: Jan 13th, 2020
Re: [Intellisense Error]Visual Studio 2019 Intellisense and namespaces
Reply #10 - Feb 2nd, 2020 at 5:34pm
Print Post  
Now it is compiling in the arduino ide targetting the STM32 L452RE but, it still throws linker errors in visual micro?
  
Back to top
 
IP Logged
 
Bambo
Member
***
Offline


Posts: 146
Location: Liverpool, UK
Joined: Jan 13th, 2020
Re: [Intellisense Error]Visual Studio 2019 Intellisense and namespaces
Reply #11 - Feb 2nd, 2020 at 5:47pm
Print Post  
Ok so the bug is -> it compiles with deep search using stm32 l452re but intellisense is broke
  
Back to top
 
IP Logged
 
Bambo
Member
***
Offline


Posts: 146
Location: Liverpool, UK
Joined: Jan 13th, 2020
Re: [Intellisense Error]Visual Studio 2019 Intellisense and namespaces
Reply #12 - Feb 2nd, 2020 at 6:01pm
Print Post  
Project folder sent the email address.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: [Intellisense Error]Visual Studio 2019 Intellisense and namespaces
Reply #13 - Feb 2nd, 2020 at 9:19pm
Print Post  
Thanks, I looked at the release notes and there was an addition for the new stm32 core back in late december. It's possible that change didn't go in the gallery release. I will investigate.

In the meantime, if you add this #include to the top of the .ino code it should build okay. The stm32 post build events create a special header that includes a varyng library library. The header is called SrcWrapper.h. 

Code
Select All
#include <SrcWrapper.h> 

  
Back to top
IP Logged
 
Bambo
Member
***
Offline


Posts: 146
Location: Liverpool, UK
Joined: Jan 13th, 2020
Re: [Intellisense Error]Visual Studio 2019 Intellisense and namespaces
Reply #14 - Feb 2nd, 2020 at 9:32pm
Print Post  
Tim@Visual Micro wrote on Feb 2nd, 2020 at 9:19pm:
Thanks, I looked at the release notes and there was an addition for the new stm32 core back in late december. It's possible that change didn't go in the gallery release. I will investigate.

In the meantime, if you add this #include to the top of the .ino code it should build okay. The stm32 post build events create a special header that includes a varyng library library. The header is called SrcWrapper.h. 

Code
Select All
#include <SrcWrapper.h> 



Thanks, It builds ok when i enable "Deep Search" but the problem is that the intellisense doesn't work when its in the Nucleo-64 board  Cry
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: [Intellisense Error]Visual Studio 2019 Intellisense and namespaces
Reply #15 - Feb 2nd, 2020 at 10:11pm
Print Post  
Yes, the default for deep search is ON so that it is compatible with Arduino IDE and users need less knowlege about each toochain and library. 

For the intellisense issue VS seems to have a problem with the #ifndef when a namespace is involved. It's  strange but for Visual Micro we just rely on whatever VS does for intellisense.

It appears to work better with "#pragma once" instead of #ifndef

Code (C++)
Select All
#pragma once
//
//#ifndef TEST_LIB_HEADER_H
//#define TEST_LIB_HEADER_H

namespace TestLibMain
{


	class TestLibMainClass
	{
	public:
		TestLibMainClass();
	protected:
	private:
	};

}

//#endif




 

« Last Edit: Feb 2nd, 2020 at 10:11pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Bambo
Member
***
Offline


Posts: 146
Location: Liverpool, UK
Joined: Jan 13th, 2020
Re: [Intellisense Error]Visual Studio 2019 Intellisense and namespaces
Reply #16 - Feb 2nd, 2020 at 10:24pm
Print Post  
Yes, see this video attached, when VS2019 opens the file, it adds it into its RAM i think. And then when the database tries to update, it clears the RAM resulting in it being forgotten, it has something to do with the visual studio .ipch files which save the intellisense information.

It's strange though because its just using the Nucelo-64 board not the Arduino Uno one. I don't suppose there are any permission changes when using the STM32/Nucle0-64 board setups?

https://stackoverflow.com/questions/14980701/how-to-change-ipch-path-in-visual-s...

See this video-> https://richardbamford.dev/dmp/peZ0qxRZOY.mp4

Maybe something to do with precompiled headers?
« Last Edit: Feb 2nd, 2020 at 10:28pm by Bambo »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: [Intellisense Error]Visual Studio 2019 Intellisense and namespaces
Reply #17 - Feb 2nd, 2020 at 10:36pm
Print Post  
Yes I think it is a VS bug. I left the #define the way you had it and pressed F12 on the namespace error in the .ino code. That took me to the namespace and then the intellisense error disappeared from the .ino.
  
Back to top
IP Logged
 
Bambo
Member
***
Offline


Posts: 146
Location: Liverpool, UK
Joined: Jan 13th, 2020
Re: [Intellisense Error]Visual Studio 2019 Intellisense and namespaces
Reply #18 - Feb 2nd, 2020 at 10:38pm
Print Post  
Tim@Visual Micro wrote on Feb 2nd, 2020 at 10:36pm:
Yes I think it is a VS bug. I left the #define the way you had it and pressed F12 on the namespace error in the .ino code. That took me to the namespace and then the intellisense error disappeared from the .ino.


Really really weird bug, i've been searching and trying to fix it all day! no luck though  Cry best i've got is that its something to do with the .ipch?
  
Back to top
 
IP Logged
 
Bambo
Member
***
Offline


Posts: 146
Location: Liverpool, UK
Joined: Jan 13th, 2020
Re: [Intellisense Error]Visual Studio 2019 Intellisense and namespaces
Reply #19 - Feb 2nd, 2020 at 10:54pm
Print Post  
It must be something to do with the nucleo-64 setting and namespaces?
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint