View the source code C++ in Eclipse - Ubuntu environtment - c++

I had loaded the project to Eclipse but when I open the .cpp file, it like to open a text file.
Anyone know how to display the code-view in eclipse?
Please support.
Thank you so much.

I cannot find C/C++ in Window -> Preferences
Then you have no CDT installed – I suppose you got the version direct from the initial download page, but that's actually the java package – there's a link 'download packages' below, where you would have found the C++ package. Not too obvious, admitted.
Never mind, you don't need to re-install: Help -> About will reveil you your installed version's name ('Kepler', 'Luna', ...); via Help -> Install new packages you can add CDT plugin to your installation. Select under work with your release version of eclipse repository, e. g. http://download.eclipse.org/releases/photon.
Minimally, you need: C/C++ Development Tools, other plugins might be useful, too, like standalone debugger, call graph visualisation, unit testing support, auto tools support (configure, make; especially under linux), possibly LLVM support (if you want to use clang compiler), ...

My issue had been fixed.
Just do below steps in ubuntu:
Go to
https://www.eclipse.org/cdt/downloads.php and download newest CDT(C/C++ Develop Tool) version.
Copy the download file
eclipse-cpp-2018-12-R-linux-gtk-x86_64.tar.gz
to your folder in Ubuntu.
Extract
eclipse-cpp-2018-12-R-linux-gtk-x86_64.tar.gz
Run execute eclipse file -> Done.

Related

Eclipse CDT missing C/C++ Unit

I'm tasked with hooking up Google Test in Eclipse. I got Google Test working from the command-line, but we want it working like JUnit for Java in Eclipse. This is theoretically possible. However, running through all the online instructions I can find, they all say to use Run -> Run Configurations... -> C/C++ Unit option. For the life of me, I can't find it. Everything else is in the Run Configurations dialog, just not that item.
So I figured, even though we have Eclipse for C++ Developers installed (which should contain everything that the CDT Plug-in contains), maybe it's missing the unit testing stuff. Trying to update CDT, however, just shows that the only thing missing is the Autotools stuff (which we have no need for).
Vital statistics:
Eclipse version: Oxygen.1a Release (4.7.1a)
Operating System: Linux, CentOS
Compiler: gcc
I know that's the not the latest version of Oxygen. It's the latest we can use, because the current versions have a bug that doesn't recognize our code as valid C++.
How do I get the C/C++ Unit option in Run Configurations?
You need to install "C/C++ unit testing support" feature. Go to Help -> Install new software, select All available sites and search for it. Installing it will require Eclipse restart. After restart C++ unit test group will appear in the list of Debug configurations.

How do I set up C/C++ on Eclipse in Windows?

I just did the default Java (8) installation of Eclipse on my Windows (8, yikes) laptop, and it seems to work just fine. However, I'm not as good at Java as I am with C and C++, and for some work it's more expeditious to use C/C++ than Java.
Unfortunately, the Eclipse installer for Windows doesn't make it very easy to set up Eclipse for C/C++. It looks like I'd be fine with Linux or BSD, but then I'd have to scrounge up another laptop (because I need the mobility) and install Linux or BSD on it. Yes, I need to leave Windows on this machine, so Windows hate isn't going to help me.
My lazy web search turned up this article: "Install Eclipse for C++ Development on Windows 7 64-bit". Is there a better installation guide than that, or does anyone care to describe the process in more detail?
Even though you have CDT features installed, you need to install a GCC compiler for windows such as MinGW or Cygwin. Once you install them, add the 'bin' folder in the installed path to the environment variables and then restart eclipse. You should now see MinGW compiler when you select "Create new C Project". After this step, proceed with your C programs and this should resolve your problems.
You will have to install a GCC compiler in your PC and then link it to the project each time you create a project. This can be done while you create a new project, or even after you have done so. You can download MinGW compiler through the following link
https://sourceforge.net/projects/mingw/files/latest/download?source=files
Once you have downloaded the compiler and installed it, it can be linked through the following steps:
i. While creating a new project, choose MinGW GCC compiler in the tool chains.
ii. Once you have finished creating a project, go to Project->Properties.
iii. Look for Run/Debug Settings in the left panel.
iv. Click on the New tab and select C/C++ Application.
v. Look for Environment option.
vi. Click on the New tab.
vii. Type "PATH" in the Name bar and fill the Value bar with the path of the compiler. For me, its C:\MinGW\bin.
vii. Click on OK and you are done!
The instructions you link to have you install Eclipse IDE for C/C++ developers which will work fine to get a C/C++ development environment up.
If you would instead like to use your EXISTING installation of Eclipse and add C++ Development Tooling (CDT) you can launch Eclipse and then use Install New Software to install the C/C++ Development Tools

How to make Qt4 work using Code::Blocks in Linux Mint

I'm trying to use Qt4 using the Code::Blocks IDE. I'm running Linux Mint and I'm getting some errors. I looked around and found some people that had the same problem as me, but I can't seem to get their solutions working on my computer.
I installed Qt4 using the command
sudo apt-get install qt4-dev-tools
And when I type whereis qt4, I get qt4: /usr/lib/qt4 /usr/include/qt4 /usr/share/qt4
If I select "Create new Projet" in Code::Blocks and Select Qt4 project, it asks for Qt's location, which is $(#qt4) by default. If I click next, it says Code::Blocks doesn't know the "qt4" variable and gives me a prompt to set the base location, the include directory, etc.
Since I don't have any idea as to what I should be putting in there since nothing works (either it says "QTCore cannot be found in the specified directory", or the "lib" directory couldn't be found, etc.).
I tried what was posted on this forum: http://crunchbang.org/forums/viewtopic.php?id=18210, but it didn't solve my problem and I get the same errors.
In the "/usr/share/qt4" directory, there's a link to the "include" directory, but not to the "lib" directory.
I'm pretty new to Linux and all of this, so I'd like it if the answer was very detailed explaining what I did wrong / what I have to do.
Install the QtSDK
As a first step I would advise you to download directly the QtSDK, from the project site here.
Note: You could also use the precompiled version for your Mint version,
but in my personal experience, when working with external SDK,
you have more independence in development, it also allows you to work
freely with multiple versions of Qt simultaneously without move any
dependence of your OS.
You can follow the graphics steps to install the SDK, I advise you to check the option "download source", later this is going to be used for debugging code, and if necessary will allow the recompilation of some classes.
Now your QtSDK is installed on the folder eg "/usr/local"
So, all references inside your IDE should refer to this location.
Install the C::B
You can use the version available in "Software Manager"
Configure the C::B
When we start a new project and asks the location of our SDK we indicate this directory /usr/local/QtSDK/Desktop/Qt/4.8.1/gcc
Now the project is ready!
Note: "/usr/local" and "4.8.1" are variables depending on where
and what version you have installed.
Is very likely that your build directory, is not correctly assigned in "Settings->Compiler and Debugger->Toolchain ...->Compiler's Directory"
will be the default "usr" which should be replaced by "/usr/bin"
Now, when compiling with the standard project ".pro" and if your project has the requirement to use a "moc" tool strategy, the simplest way to do that, is use a customized Makefile, with all stages of compilation.
To learn how to make a customized makefile, you can read this answer.
And although I would advise again:
Although that CB is an optimal environment for working with wxWidgets, and C/C++ in general, I personally think that in the case of working with Qt, QtCreator provides a development environment more native and optimized to work with your projects QT.

Cygwin and Eclipse Helios setup

I am trying to learn C++ with Cygwin and Eclipse Helios.
I got all the development tools under Cygwin installed; and installed the CDT package for Helios.
The problem is I don't see an option to create a C++ project from makefile or any other option. I can only see options for a C Project, C++ project and a new project from existing source code.
Here is what I referred to:
Eclipse seminar
Developing applications using the Eclipse C/C++ Development Toolkit
Questions:
Is there any clear guide to setup Eclipse for Cygwin?
Am I missing something in the setup?
any other suggestion will be helpful.
Are you asking how to setup GCC in cygwin + Eclipse? How about this tutorial?
I found this tutorial to be a very good source. It was almostperfect, apart that one more path needed to be add to the folder containing cygstdc++-6.dll which prevented anything to be printed on console. So, add to the Project Properties -> C/C++ General -> Paths and Symbols -> Includes GNU C++ the path to the missing dll folder: ${CYGWIN_HOME}/usr/i686-pc-cygwin/sys-root/usr/bin.

What plugins do you use along with Eclipse CDT?

Suggest some plugins you find useful in your day by day work.
Eclipse CDT repositories:
Helios: http://download.eclipse.org/releases/helios
C++ Development Tools: http://download.eclipse.org/tools/cdt/releases/helios
Plugins:
Subclipse: http://subclipse.tigris.org/update_1.6.x
Eclipse Linux Tools: http://download.eclipse.org/technology/linuxtools/update
CMakeBuilder: http://www.cmakebuilder.com/update
CMake Editor: http://cmakeed.sourceforge.net/updates
Qt Eclipse Integration: Installation instructions link
Eclipse CORBA Plugin: http://eclipsecorba.sourceforge.net/update
Please add one plugin with its eclipse update url for posting.
I am using
Qt plugin for Eclipse
CMakeEdit for colorful CMakeLists.txt ;-)
Subversion (tried subversive, didn't work for me)
tried the linuxtools plugins (very ambitious project) for valgrind etc., but they are not
really working ATM
I use a self-made plugin to do automated builds of CDT projects.
THis plugin is automatically creating a workspace from a description file that contains the project names, disables the indexer and auto-build, sets the wanted build configuration in all projects and then builds the temporary workspace.
I use viplugin to get vim keybindings in Eclipse.
EGit - it's definitely helpful although I still do a fair amount of gitty stuff on the command line (and EGit stays in sync with changes I make on the command line, of course).