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
Cant find a way to disable #pragma warnings in VS2017 (Read 560 times)
FrankP
Member
***
Offline



Posts: 100
Cant find a way to disable #pragma warnings in VS2017
Dec 12th, 2018 at 1:03am
 
I have VM/VS2017 on an old Windows 7 box, and also on a new Win 10 box.  On my Win7 box, I can use #pragma region and #pragma endregion without generating any compiler warnings.  However, the same code on my Win10 box does generate "warning: ignoring #pragma endregion Low [-Wunknown-pragmas]" warnings.  Here's an example of usage in a project
Code:
#pragma region LOW_POWER
	//------------------- LOW POWER OPERATION ------------------------------
	//12/03/18 added for low-power wakeup from digital pins
	/********************************************************/
	digital.pinMode(21, INPUT_PULLUP, RISING);//pin, mode, type
	digital.pinMode(22, INPUT_PULLUP, RISING);//pin, mode, type
	/********************************************************/

	/********************************************************
	 Set Low Power Timer wake up in milliseconds.
	 ********************************************************/
	timer.setTimer(5000);// milliseconds
	//------------------- LOW POWER OPERATION ------------------------------
#pragma endregion Low Power Operation Setup

 




I vaguely remember changing a compiler setting on my Win 7 box to suppress #pragma warnings, but for the life of me I cannot find where I did that. 

Anyone here have a clue where that setting is in VS2017 (community edition)?

TIA,

Frank
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10155
United Kingdom
Re: Cant find a way to disable #pragma warnings in VS2017
Reply #1 - Dec 12th, 2018 at 12:05pm
 
I think you are using different toolchains on each machine.
Back to top
 
WWW  
IP Logged
 
FrankP
Member
***
Offline



Posts: 100
Re: Cant find a way to disable #pragma warnings in VS2017
Reply #2 - Dec 12th, 2018 at 3:19pm
 
Can you be a little more specific?  I have no idea how or why a 'different toolchain' would affect whether or not I'm getting pragma warnings.  I've searched around quite a bit, and it seems there is a compiler option that will suppress pragma warnings, but I can't remember how I implemented that on my old machine - grrrr.

Regards,

Frank
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10155
United Kingdom
Re: Cant find a way to disable #pragma warnings in VS2017
Reply #3 - Dec 12th, 2018 at 10:40pm
 
The error is produced by the toolchain during compile. Visual Micro runs the toolchain to compile. Visual Studio plays no part in the compile.

You should also make sure you have the same warnings setting on the vMicro menu between both machines.
Back to top
« Last Edit: Dec 12th, 2018 at 10:57pm by Visual Micro »  
WWW  
IP Logged
 
FrankP
Member
***
Offline



Posts: 100
Re: Cant find a way to disable #pragma warnings in VS2017
Reply #4 - Dec 13th, 2018 at 2:25am
 
Visual Micro wrote on Dec 12th, 2018 at 10:40pm:
You should also make sure you have the same warnings setting on the vMicro menu between both machines.


OK, that jogged my memory Wink

Apparently I had 'Warnings for Project' UNchecked on my Win7 box, and checked on my Win10 box.  UNchecking 'Warnings for Project' suppressed the pragma (and all other) warnings.

So, I got a bit smarter (I hope) and added the '-Wno-unknown-pragmas' flag to the "extra cpp flags" line in the vMicro/Compiler/Advanced/ dialog.  This suppresses the unknown pragma warning while (hopefully) keeping other warnings enabled.

Apparently "extra cpp flags" this is a project-level setting. Any way to do this globally so all my Arduino projects have it?

TIA,

Frank



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



Posts: 10155
United Kingdom
Re: Cant find a way to disable #pragma warnings in VS2017
Reply #5 - Dec 14th, 2018 at 2:02pm
 
Great. You could edit the platform.txt for the platform that you are using and change the ccp recipe/pattern to include the flag. You would need to repeat this in the future after installing updated toolchains.
Back to top
« Last Edit: Dec 14th, 2018 at 2:02pm by Visual Micro »  
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print