# FreeBSD C++ development



## AlexF (Mar 24, 2010)

Currently I have the program working in Ubuntu, written in C++. I use Eclipse CDT and GCC compiler for the program build. I need to build this program in the FreeBSD OS. What are my options?
Are GCC and Eclipse CDT available for FreeBSD? If not, what C++ development tools are used in this OS?
Is it possible to use my existing source files and makefiles developed in Ubuntu to build the program in FreeBSD from the command line?


----------



## SirDice (Mar 24, 2010)

AlexF said:
			
		

> Are GCC and Eclipse CDT available for FreeBSD?


GCC is part of the base OS. And eclipse can be installed as a port: java/eclipse.



> Is it possible to use my existing source files and makefiles developed in Ubuntu to build the program in FreeBSD from the command line?


Yes, but wether or not it builds or runs correctly depends entirely on your source code.


----------



## tankist02 (Mar 24, 2010)

GCC in the base is not the latest (gcc 4.2). You can get fresher stuff from ports:

lang/gcc43
lang/gcc44

and even

lang/gcc45


----------



## rambetter (Mar 25, 2010)

One thing to watch out for when compiling Linux-friendly C/C++ programs that use Makefiles is as follows.  On Linux, the ``make'' command is called GNU make.  On FreeBSD, when you run ``make'', it's not GNU make.  It's actually quite different.  Generally, Makefiles that FreeBSD understands will execute fine with GNU make, but not vice versa (at least not all the time).  Therefore, if you are having make-related problems when compiling Linux-friendly programs, and if you're using make from the command-line, I would suggest installing GNU make on FreeBSD, which is the port devel/gmake.  You'd call ``gmake'' on FreeBSD instead of ``make'' to invoke GNU make.


----------



## fender0107401 (Mar 26, 2010)

I recommend use devel/cmake to generate the Makefile.

If you don't know what it is, try google "cmake introduction" or something else.


----------



## fender0107401 (Mar 26, 2010)

Furthermore, try editor/gvim, devel/gindent, devel/cscope, devel/ctags.


----------



## gcooper@ (Mar 26, 2010)

rambetter said:
			
		

> One thing to watch out for when compiling Linux-friendly C/C++ programs that use Makefiles is as follows.  On Linux, the ``make'' command is called GNU make.  On FreeBSD, when you run ``make'', it's not GNU make.  It's actually quite different.  Generally, Makefiles that FreeBSD understands will execute fine with GNU make, but not vice versa (at least not all the time).  Therefore, if you are having make-related problems when compiling Linux-friendly programs, and if you're using make from the command-line, I would suggest installing GNU make on FreeBSD, which is the port devel/gmake.  You'd call ``gmake'' on FreeBSD instead of ``make'' to invoke GNU make.



BSD make is commonly referred to as pmake (parallel make); since make also has POSIX paradigms there are some idioms common to gmake and pmake, but apart from basic goal / target definitions, basic variable definitions, and target -> dependency ordering and definitions, they're completely different animals.


----------

