conditional-compilation

How to define a variable in a makefile and then use it within Fortran code

会有一股神秘感。 提交于 2019-12-11 02:59:37
问题 I am trying to define a variable in a makefile, and then depending on whether that variable is set, change which code block is compiled in my Fortran routine. Simple example I can't get working: program test implicit none integer :: a #ifdef MYVAR a = 1 #else a = 0 #endif write(*,*) a end program test My makefile is: MYVAR=1 all: ifort temp.F90 -fpp echo $(MYVAR) The echo $(MYVAR) line correctly prints 1. However, when the test program is compiled it sets a=0. How do I get the Fortran code to

Can AppHarbor set a conditional compilation symbol during build?

ぃ、小莉子 提交于 2019-12-10 21:27:55
问题 Can AppHarbor set a conditional compilation symbol during build? Maybe simply: AppHarbor I have some tests that can't run on the server (they rely on test data files). If AppHarbor could set a conditional compilation symbol, then I could add an [Ignore] attribute on the test when that symbol is present. Or, is there a better or different way to ignore specific tests when running at AppHarbor? Or, is there a way for the test code to correctly reference a test data file residing in the project?

Conditional Compilation seems to be not working in Xamarin Studio

拟墨画扇 提交于 2019-12-10 21:15:39
问题 I created a Xamarin Forms app. And inside a new page with a label named "MyLabel". In the code behind for my page I have private void SetUpUI() { #if __IOS__ this.MyLabel.BackgroundColor = Color.Navy; #endif } In my iOS project options I can see symbol __IOS__ in the "Compiler" tab. (please see screenshot) When I run in iOS it doesn't make the label blue: But if I remove #if __IOS__ block it makes the label blue: So it seems conditional compilation is not working. I'm on a Mac. So couldn't

Visual Studio incorrectly marking inactive code blocks when using `#ifdef`

落花浮王杯 提交于 2019-12-10 20:42:11
问题 My project has a bunch of #ifdefs . The macros used by these #ifdef s are usually passed through the command line using the '/D' option to get different build configurations. Visual studio incorrectly assumes that these macros are not defined and greys out the code blocks present inside these #ifdef s. The problem is not syntax highlighting - I can turn the grayed out code to colored code from Options; the main issue is that I am not able to go to the function definition of any functions

Flash Builder conditional compilation variables

给你一囗甜甜゛ 提交于 2019-12-10 17:44:49
问题 I'm using Flash Builder 4.5 and I'd like to use conditional compilation between my debug and release builds. I understand how to use conditional compilation and how to define compiler constants. What I need is either: A predefined constant set by the IDE between debug and release builds A way to specify different arguments for the compiler between debug and release builds Using ANT is not an option as of now (no time!) and changing the variables by hand every time is just too risky. 回答1: ant

Is #ifdef MACRO equivalent to a comment

感情迁移 提交于 2019-12-10 13:38:55
问题 Assuming that MACRO is not defined, are these equivalent #ifdef MACRO Not valid C or C++ code #endif /* Not valid C or C++ code */ In GCC 4.7.1, it seems to be equivalent but are there preprocessors that do more? 回答1: It depends on what you mean by "not valid C or C++ code". Text inside a comment does not have to conform to most of the rules of the language. It isn’t even tokenized. This is perfectly valid: /* This comment doesn't contain a valid sequence of preprocessing tokens (because of

How to detect in runtime if some Compiler Option (like Assertions) was set to ON?

亡梦爱人 提交于 2019-12-10 04:00:04
问题 What is the conditional to check if assertions are active in Delphi? I would like to be able to do something to suppress hints about unused variables when assertions are not active in code like procedure Whatever; var v : Integer; begin v := DoSomething; Assert(v >= 0); end; In the above code, when assertions are not active, there is a hint about variable v being assigned a value that is never used. The code is in a library which is going to be used in various environments, so I'd be able to

Why am I unable to #ifdef stdafx.h?

怎甘沉沦 提交于 2019-12-09 03:34:16
问题 I am trying to include 2 platform-specific stdafx.h files in my .cpp file, but the compiler is unhappy when I try to #ifdef it. #ifdef _WIN32 #include "stdafx.h" #elif _MAC #include "MAC/stdafx.h" #endif You may wonder why I am using stdafx.h in the Mac code, but that is not important at the moment :). When I try to compile the code on Windows, I receive: Fatal Error C1018 . I tried enclosing other header files with #ifdef in the same file, and the compiler was happy. Therefore, it looks like

If NETFX_CORE is for Windows 8, what is for Windows Phone 8?

♀尐吖头ヾ 提交于 2019-12-08 19:47:38
问题 I understand using the NETFX_CORE directive, like this: #if NETFX_CORE // Windows 8 #else // Windows Phone 8 #endif More info: http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj714084(v=vs.105).aspx But is there a directive specific to Windows Phone 8? 回答1: Yes, the Windows Phone directive is: #if WINDOWS_PHONE This is documented here, but I'm surprised that it isn't mentioned here. I also tested this in some code, and it works. 回答2: WP8 should use custom conditional compilation

Building multi-SDK Android apps in Eclipse without losing compile-time checks

六月ゝ 毕业季﹏ 提交于 2019-12-08 19:22:48
问题 I am developing an Android app in Eclipse. I would like to target a wide variety of devices and SDK versions (for example, I can optionally support multi-touch). I understand the recommended approach of isolating all the new functionality to a separate class and leveraging lazy loading to only load that class at run-time if the host device actually supports the feature. The downside of this approach is that I have to compile all of my code with the SDK of the newest feature I want to use.