Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » help with using compiler other than gcc for example Sun C compiler
help with using compiler other than gcc for example Sun C compiler [message #72425] Thu, 29 May 2003 16:48 Go to next message
Eclipse UserFriend
Originally posted by: coololdman.hotmail.com

Hi,

Does anyone tried it before and willing to share the experience ?

TIA,

daniel :-)
Re: help with using compiler other than gcc for example Sun C compiler [message #72631 is a reply to message #72425] Sun, 01 June 2003 10:56 Go to previous message
Eclipse UserFriend
Daniel Huang schrieb:
> Hi,
>
> Does anyone tried it before and willing to share the experience ?
>

I can't help with settings for the debugger.
But for building projects, even the Sun C Compiler should have some
make-tool.

Adapt your Makefile like this:

# these are the settings for GCC/G++
# adapt these to the Sun C Compiler
# C Compiler
CC = gcc
# C++ Compiler
CXX = g++
# Archiver to build libs
AR = ar
# Linker
LD = ld
# add more tools
# ...
# Compiler settings
C_DEBUG = -g
C_INCLUDE_PATHS = -I/usr/include # add more here
CFLAGS = $(C_DEBUG) $(C_INCLUDE_PATHS)
CXXFLAGS = $(CFLAGS)
LIB_PATHS = -L/usr/lib -L../mylib
LIB_USELIBS = -lmylib # add more as you need
LDFLAGS = $(LIB_PATHS) $(LIB_USELIBS)

in your Build rules use these variables instead of the commands itself
like:

$(PROGRAM): $(OBJECTS)
$(LD) -o $@ $< $(LDFLAGS)

# compile .o from .cpp
%.o: %.cpp
$(CXX) $(CXXFLAGS) -o $@ -c $<

This should work, though, I don't have an Sun C Compiler here.
If you have the make-tool and it supports the include-directive, you can
put these settings for the compiler (CC,CXX,...) in a Rules.sun-file and
include it in your Makefile like:

# comment out either one
include Rules.sun # use settings for Sun-C-Compiler
#include Rules.gnu # use settings for GCC/G++

A real difference in building projects is probably the Microsoft
Compiler, since there is the nmake tool with a different syntax for
their Makefile and also the options are started with '/' instead of '-'.
Previous Topic:File "last-modified" timestamps for imported projects
Next Topic:How To Debug Using GDB
Goto Forum:
  


Current Time: Tue Jul 22 01:42:21 EDT 2025

Powered by FUDForum. Page generated in 0.06672 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top