Using Eclipse C++ CDT in Linux - c++

I want to use Eclipse to develop C++ projects on Linux. Particularly I want to modify stable and widely used open source projects using the Eclipse CDT. One of them is Intel Opencv. There are tutorials to create simple c++ projects like here:
http://www.ibm.com/developerworks/opensource/library/os-eclipse-stlcdt/ .
I have seen plenty of tutorials for using Eclipse CDT to write programs in
OpenCv like here:
http://opencv.willowgarage.com/wiki/Eclipse
http://tommy.chheng.com/development/windows_development_setup.html
http://tommy.chheng.com/index.php/2009/05/opencv-with-eclipse-on-windows/
However I
want to use Eclipse to make changes to the OpenCv platform itself and compile it
from there. I really like many of Eclipse's features like:
Syntax highlighting
Outline
Code assist
Code templates
Code history
etc.
Would someone write a
small tutorial on how one can make a project in Eclipse from the OpenCv tarball? I would use Eclipse CDT on Linux.
Can Eclipse CDT recognize Makefile as it can do for Ant scripts?

I made the experience that for OpenCV using cmake is the way to go. You can unzip the cmake source code and use cmake to compile it. Even after your changes. There are some tools to integrate cmake into eclipse but I found them unstable or not very mature so I use cmake from a terminal to compile and eclipse for editing the source files.

If you follow Janusz's advice about using cmake you can find here a good tutorial about using cmake and its eclipse projects generator (I actually followed it no long time ago :-) ). In this link you will find more information about that generator (Eclipse CDT4 Generator)

Simplest way to deal with existing C sources with their own build setup is generally to use a 'Makefile Project' rather the 'managed Project'. For cmake, go to the 'Make Targets' view and enter cmake as the executable.
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.cdt.doc.user/getting_started/cdt_w_newproj.htm
How to import C makefile project into eclipse or put in under eclipse
http://help.eclipse.org/indigo/index.jsp?topic=/org.eclipse.cdt.doc.user/getting_started/cdt_w_existing_code.htm

Related

Which is the most efficient way to migrate from a VS window c++ project to a linux one?

Currently I'm transferring a c++ project into linux which was previously developed for windows with Visual Studio. I'm using Netbeans/Eclipse for the time being. So I'm wondering whether there is a more efficient way to migrate than that of creating a new c++ project and just adding the cpp and h files, since I have very little experience on VS.
I recommend you to use CMake. CMake is a cross-plattform build tool which allows you to build your program for different platforms. Like this you can also choose your IDE because CMake can build project files for different IDEs.
To start with CMake you should learn the basics as shown here.

using codelite with scons

How difficult is to use codelite on top of a scons project?
what features i should expect to lose? is there a way to configure codelite to use the scons configuration files to keep track of the project files.
At the moment i'm using Netbeans 7.1, but the tool doesn't scale well with complex projects like LLVM. I'm curious with codelite as it seems to have a very good code completion architecture (relying on the llvm clang plugin) but i'm not sure how hard will it be to migrate my project (based on scons) to it
I dont know anything about codelite, but eclipse is an excellent IDE with code completion like you mention. There is an SCons plugin available for eclipse called SConsolidator.
I have found that eclipse has excellent support for C++ and Python.
Why not?
But codelite is old-school IDE with very poor functional, like Visual Studio 6. I recommend use Eclipse CDT.

Switching from Visual Studio to GNU build system. Need general advice

I need to convert several large Visual Studio projects to use GNU build tools. GUI IDE is no option. Right now I am trying to learn make & autotools. There are some good tutorials online, including the official documentation. But the amount of material is quite overwhelming. I would really appropriate any newbie advice.
Where to start?
What are the typical steps?
How make make the project ready for source code distribution?
What can be skipped if source code distribution isn't needed (in house use only)?
Thanks.
I suggest you to use CMake. You could start here.
Like both Naszta and Fabio recommended: Try out CMake, because it can generate visual studio projects on windows and unix-makefiles.
In addition, I would suggest you look at MinGW: MinGW provides a GCC toolchain on Windows. You can start by porting your code to MinGW, while keeping all the windows-specific stuff. In a later phase you can try getting rid of all the windows-specific stuff.
Are you set on Autotools? Because most projects migrate away from them because autotools are so complicated.
Id also suggest CMake which is a Meta build system, and can create unix makefiles, Visual Studio Projects (and all kinds of project files for IDEs) in a platform neutral way.
It also has some goodies like CPack (which creates Installer packages for all platforms) and CTest.

opinion on using native Visual C++ projects vs makefile project

I'm working on a cross-platform C/C++ code base that has Visual C++ (super majority) & XCode developers. It also needs to compile on Linux, because that's where it's deployed. We are currently using a complicated Unix makefile that's called from Visual C++, XCode, & Unix command line.
However, the makefile project causes several productivity losses for Visual C++ developers:
Slower build times
Intellisense & text search don't work well for files not directly referenced in project
No .h dependency generation (not clear how to do on Windows)
Adding a native Visual C++ project has the following downsides:
lots of work to manage all those separate platform configuration as mentioned here Maybe VC++ 2010's hierarchical property sheets will help.
more work due to syncing makefile with native project
Currently, I'm considering to add a native project for Windows developers. Can anyone offer their experience on what's best or suggest how those problems with either approach can be reduced.
I have considered CMake and personally would use it, but it's going to be hard to convince other people to learn cmake & syncing it with the native projects would be an issue.
I have considered CMake and personally would use it, but it's going to be hard to convince other people to learn cmake & syncing it with the native projects would be an issue.
The nice thing about CMake is that it builds ALL of the configurations for you. You would setup a single CMake project, and then use it to generate VS solutions, XCode projects, and unix makefiles for you.
It's a huge improvement - everybody gets to work in their "native" environment, whether they're on Windows, Mac, or Unix.
I've handled this by writing my own converter that would synch scripts for various embedded development environments. If something like the above answer of using CMake does all that for you, then that would be the way to go. But if its too complex, rolling your own custom tool is not that hard. Just has to synch both ways.
Also, if you don't have it. Visual Assist for visual studio is awesome :)
I am not a fan of makefile generators, cmake, qmake and the like.
I am a fan of make. We have a single makefile (well, several actually but they include each other and there is no recursive make involved) which knows all of the project dependencies on all platforms (windows, wince, linux, mac, ...). This gives:
Makefile is really no more than a list of sources (include dependencies are auto-generated during the build)
Same build command on each platform, apart from specifying the tool chain
Build uses all my CPUs
Very short time-to-do-nothing
Developers can use whatever IDE they fancy
vim, emacs, qtcreator, eclipse, XCode all in use
I often use VC++ when on Windows (for the debugger)
Scriptable. Great way to automate your tests
Nice.

Build management in C++ & good IDEs on Linux

I am starting to write a moderately sized project in C++ requiring a fairly large amount of files and dependencies on other projects.
Do you think manually maintaining a Makefile for this project is the best approach?
Are there other better alternatives for C++ that make build management and dependency management of files really easy to handle?
Also, what IDE is good for C++ development on Linux? I am comfortable with Vim, but do you think there are good IDEs for C++ (like Eclipse for Java) that provide code-completion etc?
Thanks!
Ajay
Others have already recommended using CMake. To my mind you should manage your project with CMake then decide on your favourite IDE.
CMake allows you to describe the project to be built, instead of how to build it. For example: I want to create a shared library called foo with source files a.cpp, b.cpp and c.h and it requires these link dependencies. Then on unix you get libfoo.so and on windows you get foo.dll and foo.lib. All common project settings can be abstracted up to higher levels in the build tree, this keeps most files very simple. More complicated requirments can be refactored into macros.
Once your project is described like this CMake will generate makefiles and/or IDE projects. This means each developer can choose their own IDE, as well as allowing you to mandate an IDE if appropriate.
My company use CMake to build the c++ in our product on windows and solaris. It contains 600 projects and 1.5 million lines of source code. We originally chose it as a cross platform build utility when porting to solaris, however for a large project like ours it is much easier to manage the build with CMake than with Visual Studio project files. I would recommend it as a build utility for any c++ project of any size
We use the eclipse cdt on solaris and are very happy with it. Most of our development is with visual studio on windows. cmake also works well with other ides I use it with KDeveloper4 on linux at home without a hitch.
KDevelop4 (from subversion or rc1 from their site) + CMake makes life so much easier, automake should just die.
If you want a cross-platform solution, netbeans + the c++ plugin are pretty decent, not as good as kdevelop4 though.
I like CMake a lot for the whole building process (but I have almost no experience with scons or Jam).
I use vim or qtcreator. Qtcreator is still in developpment, but very promising I think.
I suggest you Code::Blocks. I use it on Debian and works gracefully.
http://www.codeblocks.org/
Edit: Added another link
http://wiki.codeblocks.org/index.php?title=The_build_process_of_Code::Blocks
Eclipse does C++ as well - through eclipse CDT - not as comprehensive as Java but pretty good.
Manually maintaining Makefiles in larger Projects becomes quite painful. If you start using automake/autoconf, you will - after a while of learning all the facets - appreciate the powerful possibilities these tools can offer.
And as IDE simply use Emacs. It's quick, powerful and supports Code completion etc.
There's also Code::Blocks as an IDE with its own building system. But I would encourage you to try out other build tools (CMake, Boost.Build, SCons) if you want to be able to build your software "anywhere" without having a fancy schmancy IDE installed. ;-)
I found Emacs + Scons works pretty well for me.