What C++ implementation/library is my IDE using? (NetBeans, MacOSX) - c++

Can anyone tell me how an IDE like NetBeans or any for that matter gather all the standard C++ libraries? For example, I created a new Netbeans C++ application, and included iostream and it worked no problem. However, if I do a search for filename "iostream" on my MacOSX Snow Leapord, it finds it in the path
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/IOKit/stream
Does that mean that my IDE is using my operating system's C++ library? It's strange because all of these files are "copyright apple" - so I'm assuming that this is a C++ implementation modified by Apple?
I was under the impression that there was 1 standard C++ libary and all compilers used that. Is Netbeans somehow just gathering the same library that Xcode is bundled with?
Essentially, I'd like to view the source of some C++ headers to gather more information about their inner-workings, but I'm worried that I am using some super-heavyweight, Apple-modified core lib that may not even be legal to use because it's under some Apple liscense.
Thanks everyone

NetBeans is just an IDE, it doesn't come with a compiler or any C++ libraries. Since it looks like you already had Xcode installed, NetBeans automatically uses compilers and libraries associated with Xcode. I have no idea what the apple licenses are, but since you bought and own your Mac, I don't think there is a problem using those headers.
Also, to view headers, just right click the code and Go To -> C++ Declaration or Header Files.

There is a place you installed g++, and your include files all come from there.
You can add additional header files by using the gcc -I switch, and that is implemented in Netbeans in the build tool chain option
further information here
I don't have a mac in hand right now, but I guess the include files will be in somewhere like:
/usr/share/g++
EDIT:
You can find the code assistance pop-up include files at:
Tools -> Options -> C/C++ -> Code Assistance

Related

Configuring C++ SDK in Intellij IDEA for Windows

I'm trying to configure Intellij to create C/C++ projects. The plugin was installed successfully but when I go to create a new project, I have to setup a Cpp SDK. Is This a path to GCC home or similar (I try it but doesn't works)? How can I perform this configuration?
Here is detailed about the configuration:
Install the plugin. There will appear no special project type for C/C++ projects. Just take/create any Java project, and the plugin will process all *.c/*.cc/*.cpp source files from the project source roots.
Then you need to specify the C/C++ dialect. Open Settings->IDE Settings->C/C++. There are three options, which can be used for tuning:
Compiler selector — you may choose between GCC and MS VC dialects
Use C dialect — this option makes the compiler to treat the sources like C, not CPP files.
GCC executable name — gcc is used if this field is left blank. This option is important for GCC configuration autodetection.
To parse the files you also need to specify include paths for your C/C++ environment. Currently, the plugin can automatically detect GCC include paths, in case of other compilers you need to specify the include paths by yourself. Additional include files can be specified for each project separately. Automatic gcc include paths detection works only if your compiler presents in path. If it does not (or if you want to use include-paths of a non-default compiler), then you should specify the name (full name, if necessary) of gcc executable in GCC executable name field.
UPDATE: I would suggest you to try JetBrain's CLion - The intelligent cross-platform C/C++ IDE for cross platform development.
If you are using Visual Studio then use Resharper C++. ReSharper C++ makes Microsoft Visual Studio a much better IDE with refactorings, navigation, code inspections, quick-fixes, code generation and more productivity features for C++ development.

How to compile c++11 code with android ndk and eclipse?

I'm using android NDK r8d, and eclipse Juno. I'm trying to compile C++ code which uses C++11 stuff like mutex, lock_guard, shared_ptr, etc. in a native android project in eclipse.
I get errors like:
"error: 'shared_ptr' is not a member of 'std'"
"fatal error: mutex: No such file or directory"
I came across a similar question here. It seems to work for them, but the explanation there is not complete so I can't get it to work for me.
I added "NDK_TOOLCHAIN_VERSION=4.7" to the Application.mk and "LOCAL_CFLAGS += -std=c++11" to Android.mk file. Still, it doesn't compile.
In the link above it says:
"Be sure that the standard library include path (like
/android-ndk-r8d/sources/cxx-stl/gnu-libstdc++/4.7/include) is in the
target settings."
How and where do I insert it?
I also get errors in eclipse IDE (on the source, before compiling). I know I should define "__GXX_EXPERIMENTAL_CXX0X__" to resolve them but I just don't know where to put it.
So, if someone could post an answer with a full explanation of how to compile and make eclipse work with C++11 it would be great.
Regarding your first question:
Go to Project > Properties > C/C++ General / Paths and Symbols
In the "Includes" tab, add the proper directory, e.g.
/android-ndk-r8d/sources/cxx-stl/gnu-libstdc++/4.7/include
Regarding your second question, I'm also looking for an answer. It is absolutely not clear how to define the GXX_EXPERIMENTAL_CXX0X macro in Eclipse.
Some say that it should be "added as a predefined macro to the indexer", but it looks like we both could not find a way to implement that...
I have read elsewhere that it should be added to "C/C++ General / Paths and Symbols / Symbols / GNU C++" but I can't find the "Symbols / GNU C++" part in my version of Indigo.
I find export an environment variable NDK_TOOLCHAIN_VERSION=4.8 before i start eclipse can solve this problem.
Eclipse use ndk's default toolchain version 4.6, if NDK_TOOLCHAIN_VERSION is not define, and gcc witch this version does not support all c++11's future like multithread and so on.

gtksourceview compiling in code blocks

i want to use gtksourceview in my c++ project. I dig around the IDE of code::blocks and really find it helpfull. i specify gtkmm directory in linker and include options but as i look for gtksourceview i found a libgtksourceview-2.0-0.dll file i really don't know how to add this in code::blocks and use gtksourceview. I am have programming experience in C for microcontrollers just and now i have not really idea about the compilation process of gcc and g++. and can i able to add the file directives as
#include <gtksourceview/gtksourceview.h>
please help
sorry if it seems so basic question for someone but i really stuck of to compile the code and then asking.
I am using windows by the way.
Thanks in advance
There are two different things: the runtime libraries and the development headers. The former allows you to run the applications (also to link them), the later to compile them. Either you are missing the header files (gtksourceview.h in your example) or setting the PATH in your IDE to find the header files.
Check the manual for 'Including libraries'.

What does the lock next to the include directory mean?

I am using Netbeans 7.2.1 for Ubuntu Quantal Quetzal to program C++. Unfortunately, its code assistance doesn't recognize features of C++11 even after I specified the C++ version to be C++11 and then re-parsed my code.
My code, which replies on C++11 features such as unordered_map are compiling and running just fine though.
Hence, I hypothesized that I might not be telling code assistance to seek the right directories for various headers. Hence, I went to Tools -> Options -> c/C++ and added some more directories in the "Include Directories" section (for 4.7.2):
Strangely, next to the directories I just added are little keys. What do these little keys mean?
Fyi, code assistance still does not recognize C++11 features.
They are almost certainly the include paths built into the compiler. The code assistant needs to know them or it will miss vital information needed for understanding the other headers and completions but because they are built into the compiler they cannot be changed by the user so they have a key next to them to show they cannot be changed
This is however an educated guess based on my work in other C++ IDEs and knowledge of how compilers handle this stuff
Assuming you are using gcc you can find a list of the built in include directories with echo | g++ -Wp,-v -x c++ - -fsyntax-only and check if they match up.

Programming language that doesn't require a runtime/dependency to be installed

I want to know a programming language that doesn't require a runtime/dependency to be installed on the target system. My primary target is Windows XP and above.
I tried Autohotkey but it dosent have many advance functions.
Firstly, please confirm that does 'C++' requires to install a runtime/dependency on the target system is is Win XP or later. Secondly, please suggest me an alternative to C++ that doesnt require a dependency to be installed.
UPDATE: I will be using CodeBlocks! Does the C++ code compiled with that requires a dependency?
UPDATE: Sorry for the misconception, by CodeBlocks I mean the default compiler of CodeBlocks (ie: GNU GCC Compiler or MinGW).
Everything usually depends on the project, not the language. For example, programs compiled in Visual Studio's C++ uses some runtime libraries to work properly. However, you can configure the project in such way, that these libraries are included in the executable file, thus not needing additional dependencies. Delphi works similarly.
Here's the setting for Visual Studio Project:
If you choose option with "DLL", your program will require runtime DLLs. Otherwise it will be standalone, the runtimes will be incorporated into your binary file.
Edit: In response to question edit
I'll repeat myself: it depends on project, not the compiler or IDE.
If you want to create a program that does not require anything else in order to run, except for base operating system (no .NET, no Java, no Perl, no runtime libraries, etc), then your best bet is to use C or C++ and compile your program as single statically compiled executable.
It is rather difficult to achieve in practice, but it can be done.
Codeblocks is not a compiler, but an IDE, that can use different compilers.
The most common one is MinGW.
To complie with minGW so that all the standard libraries are statically linked you shold configure your project (see "project settings") so the the linker options include the -static flag.
You can even be more specific by stecifying
-static-libgcc
-static-libstdc++