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 Enabling RTTI when compiling (Read 4895 times)
Bas
Junior Member
**
Offline


Posts: 50
Joined: Feb 20th, 2017
Enabling RTTI when compiling
Sep 15th, 2017 at 10:09pm
Print Post  
I would like to use dynamic_cast<> i my code but when I do i get the error

Quote:
error: 'dynamic_cast' not permitted with -fno-rtti


How do I enable this compiler option?
Strange thing is that i cannot find this option in the verbose log of the compiler.
  

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


Posts: 50
Joined: Feb 20th, 2017
Re: Enabling RTTI when compiling
Reply #1 - Sep 16th, 2017 at 2:29pm
Print Post  
I've found where to enable the rtti option, in the platform.txt file of the board

Code
Select All
compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -frtti
 



This actually works and compiles the c++ files with rtti enabled.

BUT ....

Now the linker is tripping over something and sends me the following message:

Quote:
Linking it all together ...
3.5.4-arduino2/bin/avr-g++" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections,--relax -mmcu=atmega2560 -o o.elf" [..removed rest of command ...]
ccNLxbjy.ltrans1.ltrans.o*: (.rodata+0x10a): undefined reference to vtable for __cxxabiv1::__class_type_info
ccNLxbjy.ltrans1.ltrans.o*: (.rodata+0x186): undefined reference to vtable for __cxxabiv1::__vmi_class_type_info
ccNLxbjy.ltrans1.ltrans.o*: (.rodata+0x19a): undefined reference to vtable for __cxxabiv1::__class_type_info
ccNLxbjy.ltrans1.ltrans.o*: (.rodata+0x19e): undefined reference to vtable for __cxxabiv1::__class_type_info
ccNLxbjy.ltrans1.ltrans.o*: (.rodata+0x1a2): undefined reference to vtable for __cxxabiv1::__si_class_type_info


Anybody any idea how to solve this?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Enabling RTTI when compiling
Reply #2 - Sep 16th, 2017 at 2:59pm
Print Post  
Hi,

If you think visual micro can be changed in anyway to help you then I am keen to hear any suggestions.

Sadly I don't think I can help as is. You are into the cpp world and how the arduino build process works. 

The linker command is also in platform.txt but I suspect that the issue is slightly more complex.

For testing you can paste chosen platform.txt lines into a board.txt in the local project. Click save after making changes to board.txt then click build and platform.txt commands will be overridden where specified in board.txt

It's easier than clicking rescan each time you change platform.txt

  
Back to top
WWW  
IP Logged
 
Bas
Junior Member
**
Offline


Posts: 50
Joined: Feb 20th, 2017
Re: Enabling RTTI when compiling
Reply #3 - Sep 16th, 2017 at 3:04pm
Print Post  
So if i understand correctly than a boards.txt file in the project will override the boards.txt and platform.txt in the arduino library?

Can i also make a platform.local.txt in the project?

Thanks for the tip
« Last Edit: Sep 16th, 2017 at 3:05pm by Bas »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Enabling RTTI when compiling
Reply #4 - Sep 16th, 2017 at 3:13pm
Print Post  
Ah no, it's called a board.txt singular.

Consider that the board out of boards.txt and platform.txt and platform.local are all merged prior to compile. Just after that anything in board.txt is applied. Then the compile happens.

So the core files must exists as normal and board.txt used just to tweak a few settings.



  
Back to top
WWW  
IP Logged
 
Bas
Junior Member
**
Offline


Posts: 50
Joined: Feb 20th, 2017
Re: Enabling RTTI when compiling
Reply #5 - Sep 16th, 2017 at 5:50pm
Print Post  
Ok,thanks, that's clear!

When i have shared projects in my solution, does every project have to have its own board.txt or is the  boards.txt in the main project used for compiling all shared projects too?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Enabling RTTI when compiling
Reply #6 - Sep 16th, 2017 at 6:06pm
Print Post  
The board.txt can only exist in normal projects, not shared projects.

A shared project is never built and does not have an architecture. Shared projects are always merged with the main project during compile. The architecture and build properties of the main project are used for intellisense and build.

This means that one shared project can be compiled with different sets of build properties.
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint