Integrating Clang Within NetBeans? - c++

What are the steps involved in integrating Clang within NetBeans? I would like to also see the Clang error and warning messages from within NetBeans. This will be used mainly for developing in C.

NetBeans 7.2 has supported Clang natively.
Just open up Options Window, switch to C/C++ section, and add a new Tool Collection. Type: /usr/bin in Base Directory, and select "CLang" in the combo box.
I have been using Clang to build my project, and NetBeans works with Clang perfectly.

Here is a link to the bug report for clang support in netbeans at netbeans.org. Track this bug for official netbeans support.

If you have downloaded and installed the C/C++ plug-in for NetBeans 8+ following the instructions on this page:
https://netbeans.org/community/releases/80/cpp-setup-instructions.html
you have a C/C++ item in the upper menu of the Tools > Options panel. 1.) Click it.
2.) Now under the list called "Tool Collection" (on the left) click the left button "Add".
3.) In the window that opens, enter the "/usr/bin" as a base directory.
4.) If you have a CLang compiler installed right the "Tool Collection Family" drop-down menu will show a CLang collection. Choose it.
5.) Click "OK" in the pop-up window, then click "OK" in the "Options" panel/window.
Enjoy.

Related

when I try to build on codeblocks and I don't understand why

I used to use dev c++ but now I decided to switch over to codeblocks. dev c++ worked normally but when I try to build on codeblocks nothing happens. I typed out some code compiled it and build it but when I tried to run it a message popped up saying I haven't build it yet and if I would like to build it now. when I clicked yes nothing happend and when I clicked no it would run but not work normally. some youtube videos recommended going to settings then compiler, selecting GNU GCC compiler, going to Toolchain executables and cliicking auto detect. in my case when I clicked auto detect a message saying could not auto-detect installation path of "GNU GCC Compiler". what should I do to fix these errors
install GCC then add its path to environment variable in path then click auto-detect again
if you're on windows
type environment variables in search box
click environment variables button in the dialog
in System Variables group double-click path(add one if missing)
click New then Browse buttons, naviagete to GCC folder
click Ok buttons to confirm, then back to code::blocks to auto-detect
or set the path to GCC manually in Toolchain executables tab

Netbeans 9 C++ Support

I wonder if there is a support for C++ in Netbeans 9. This link shows C++ on screenshot (when creating new project). However, after installing, I don't have one.
I wonder if there is a support for C++ in NetBeans 9.
The answer to that is definitely no, and definitely yes...
No, in the sense that the use of C++ on NetBeans 9 is not currently supported by Apache, and it is done at your own risk. NetBeans is currently being handed over from Oracle to Apache, and they haven't got to the C/C++ part yet. See What's Happened to My Favorite NetBeans Plugins? for more information.
Yes, in the sense that it is technically feasible to do it; the NetBeans 9 IDE allows you to use C/C++.
This is what you need to do:
Step 1 of 2: Make C/C++ available as a plugin.
Tools > Plugins > Settings tab > click the Add button.
On the Update Center Customizer screen:
Enter some value in the Name field (e.g. "My plugins"),
Enter http://updates.netbeans.org/netbeans/updates/8.2/uc/final/distribution/catalog.xml.gz in the URL field
Click the OK button.
This should create a new entry in the Configuration of Update Centers list in the Settings tab.
Checking that new entry should instantly add plugins to the Available Plugins tab.
Click the Available Plugins tab, then click the Category column to sort the entries by category.
The Name of the entry at the top of the list should be C/C++. If so, you have successfully made the plugin available:
Step 2 of 2: Install the C/C++ plugin.
Check the C/C++ entry shown in the screen shot above, and then click the Install button.
Follow the wizard's instructions. The plugin will be downloaded and installed, and you will be required to restart NetBeans.
To confirm that C/C++ has been installed, click Tools > Plugins > **Installed tab. You should see an entry for the C/C++ plugin you just installed.
Also, verify that you can now create a C/C++ project through the Project wizard:
Notes:
The finer details on configuring C/C++ on NetBeans 9 (Tools > Options > C/C++) are unchanged from NetBeans 8.x. Refer to Configuring NetBeans IDE 8.0 for C/C++/Fortran for that.
Much of this answer has been copied from an answer I gave on problems with Tomcat on NetBeans 9, but the details are sufficiently different to merit a separate answer.
Netbeans 10 and 11 - adding C / C++ also works in the same fashion.
In Netbeans go to Tools->Plugins->Settings
Entry NetBeans 8.2 Plugin Portal is already present.
Click the checkbox next to this entry.
Switch to Available Plugins tab, click Check for Newest.
C / C++ is now on the list.
Computer that this is done is on Windows 10 x64.
You have to install C++ plugin (Tools -> Plugins)

C++ Lambda error on Mac (gcc out of date?) [duplicate]

This question was asked many times and I failed to replicate all of the solutions I could find. I am unable to find this setting under File->Project Settings (as some suggested). Please be very specific. If you know an answer for Xcode 7, chances are it will work for me too.
It's the same for 7 and 8. From the Project Navigator, select the project. In the main panel, at the top left, select the target. Now the main panel should have General, Resource Tags, Build Settings, Build Phases, & Build Rules along the top. Select Build Settings, select All. Scroll down to "Apple LLVM 8.0 Language C++" and expand it. Change "C++ Language Dialect" to "C++11 [-std=c++11]".
Build Settings -> Linking-> other linker flags -> add to "-lc++"

How to change/configure desired compiler in Qt creator? i.e. switch between MSVC/Mingw or g++/clang++

I am aware about how to add compiler in Qt Creator. However my Qt always chooses MSVC compiler. How to set MinGW (built-in or external) instead of MSVC?
Couldn't find any post which can help a newbie to know how to change the compiler of desired preference. My current system is Windows, however information on Linux (g++ <--> clang++) is also welcome.
Following is the way with Qt 5.9:
While configuring a new project, select only those compilers/kits which are required;
For 64-bit system, get the latest MinGW and install in a suitable path; While installing MinGW64, you may select "posix threads", and not "win32 threads" to allow threading related libraries
Go to Tools > Options > Build & Run > Compilers and add a manual C++ compiler. Choose the path of where you installed C:/MinGW64/bin/g++.exe (name it something like "MinGW64"); Similarly you may add C compiler as well with C:/MinGW64/bin/gcc.exe; Click 'Apply'
In the same dialog box, select the Debuggers tab and similarly add C:/MinGW64/bin/gdb.exe (name it like "MinGW64 Debugger); Click 'Apply'
In the same dialog box, select the Qt Versions and add a new Kit with MinGW64 like name; However I couldn't find an appropriate qmake.exe for it; Hence, I decided to use the same qmake.exe, which came with built-in 32 bit MinGW within Qt package (not sure about this as of now)
In the same dialog box, now select the Kits tab and add a new Manual kit; You may also follow the way the default MinGW32 bit compiler is configured; Configure Compiler, Debugger and Qt Version for this newly named kit; Click 'Ok'
On the left pan of Qt creator, click on "Projects" tab, and go to "Build & Run" option there; To avoid confusion, you may disable all the kits which are not required; Just keep the relevant kit and click "Build" with either "Debug" or "Release" setting

How to define g++ or clang++ in xcode 4?

How do I use a c++ compiler (g++ or clang++) to compile a simple c++ project in xCode 4?
You can assume I am in the project, in the Build Settings.
I have in Build Options -> Compiler for C/C++/Objective-C -> Apple LLVM compiler 3.0 and LLVM GCC 4.2 as options.
Is either one appropriate or do I have to install another one?
How do I do that?
For running a simple code with Xcode after running Xcode choose “Create a new XCode project”. (You can also go to “File|New|New Project...” or press Shift-⌘-N). This will bring up a screen in that screen select "Application"then select "Command Line Tool" and then click next .Now enter a name for your project and select type c++ and click next in upcoming screen select a directory for you project and click "create" now you can write codes in main.cpp file in the left panel for running your code just click on "Run" button .
Update:
In Build options click "Build settings" and then click "All" from "C++ language Dialect"and "C++ standard library"tab you can choose the compiler and c++ standard that you want included c++11.