Is there a way to configure a given target to only compile under certain build configurations?
For example, let's say I have a simple shell tool that compiles alongside a larger library to test it. Can I set it to compile under the "Debug" build configuration, but not "Release?"
I believe what you need to do is something like
#ifdef RELEASE
// if we get here it won't compile
#error
#endif
I know that's quite dirty, I do apologize - hopefully someone more experience in Xcode/Objective-C will have an answer!
Related
I have tried the download folder for kotlininc, and did everything the instructions said. And I'm still getting an error saying:
error: Could not find or load main class org.jetbrains.kotlin.runner.Main
Is there a lite weight simple kotlin compiler for windows which is easy to install?
something like javac
or g++
etc
If you don't want an IDE, I would recommend using a build tool. Kotlin supports Ant, Maven, and Gradle.
Of course, using the plain kotlinc command-line compiler is the simplest, but you already linked to it. If you need help figuring out what you're doing wrong with that, create a new question and explain/show what you've tried.
I have some C++ code using NEON intrinsics. From what I have read, all you need to do is include arm_neon.h to your project.. And then I read that this arm_neon.h header is not actually readily available to you automatically, you have to get it from the web. So I found and added this version to my project:
http://clang.llvm.org/doxygen/arm__neon_8h-source.html
In my project's prefix.pch I added:
#import "arm_neon.h"
And when I try to build on my iPhone6 device (I am not using the simulator), I get a billion errors inside the arm_neon.h file:
Can anyone please explain to me what I am missing here?
You've been misinformed about being able to pick up an arm_neon.h from the Internet. Generally the header is not just compiler specific, but compiler version (even compiler revision) specific. For GCC it relies on a number of compiler built in function calls, and from your screenshot of Clang the same holds there. As you'd expect, if the name of these internal-only functions changes, the header will fail to compile.
What surprises me is that you're unable to use an include of whichever arm_neon.h ships with your build environment. The only thing I can think of that would cause this is the build command trying to build for x86_64 (for the simulator) but you say this isn't what is happening. It might be worth checking your build settings one more time.
If you're still not getting anywhere, remember that arm_neon.h is sometimes considered as a system header, so in C++ you might need to #include <arm_neon.h> rather than #include "arm_neon.h" to get the compiler to search the system paths.
Thinking about NetBeans or Eclipse I was wondering how an IDE compiles code when you click run. Does it open a command line in the background to compile it? How exactly does it work?
Each IDE will have it's own approach for how they actually achieve compilation. Usually they will have their own compilers or wrappers around existing compilers to which they delegate actual compilation.
Eclipse comes with a built in compiler of its own:
How does Eclipse compile classes with only a JRE?
I don't actually personally know much about how other ones achieve the compilation in any detail; somebody else may provide a better answer in that regard.
IDEs use compilers. That's actually the difference between them.
For instance, Code::Blocks uses MinGW Compiler which is a port of the GCC set of compilers.
Every compiler has its own method, some use their own wrappers and ports for known compilers. (See Codeblocks)
I also noticed that some basic IDEs out there, just run the simple command line using gcc, clang, etc and let you pass parameters from an option window.
I'd like to compile differently based on which build configuration I'm using. Something like
#ifdef DEBUG
// debug code goes here
#endif
I know I can do this by defining preprocessor macros for each build configuration. But I'm wondering if there's already something built-in I can ues. Is there?
This is what I've always used and it's very clean. It also comes up when you search your code, which is nice, since settings, etc...may not.
I'm running cl for my build phase. How do I compile embedded resources into the final executable?
Run rc.exe to compile the .rc script into a .res. Pass that to the linker to get it embedded in the final image.
There are preciously few reasons to not just let the IDE take care of this btw. It does a lot of other stuff automagically. Like getting the proper manifest embedded. And creating a debug build that helps you diagnose uninitialized variables and stack corruption. And supporting edit + continue. But yes, you can do this too if you know all the command line switches. Best way to find them is to build some sample projects with the IDE and look at the build log files to see what's being used.