I want to compile c++ file in suse. Like my fedora pc. Could any one give my any hints.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Should be the same. Use ‘gcc’. If you do not have ‘gcc’ then install it:
zypper in gcc
Good luck.
julian5 wrote:
> I want to compile c++ file in suse. Like my fedora pc. Could any one
> give my any hints.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iQIcBAEBAgAGBQJJtTLlAAoJEF+XTK08PnB5BB0P/2T55dAQShWDczGTsQTqfL7H
0UD4ay5UZP5Ma1veLs0zL3RFTXdS/APAjGDTDvnPYG5qtDFMAFeo8sYIU0EYtsBn
TzVYuNIIaXtBg28ZhRqsUjkwTLEI1r4Kq8154YPLfDBPoGaxCbq9acjXJVTVyMF6
Pjk7oHEi1rGhVwqIuyAh4vWwGVDcS6kBuPAqZDV2WZKZwP/VDTBJNb7b21xHuSRZ
xBi5hw7wjMjFqZT8JXjrRAuqBww4fTNGO70uagCz8t5KShPmLCbdFUxWdA9WPmHj
GhchXKvy6WD7/E3T6ZYABTNl1C+Giy2xWZNtBEgojY+pcFXGQ4mfk15DsrotfRyt
rConWEtopsLnAQcINWYc+DMcIciCnk7c9ZFUOvtHu2NWbamHVcQkaotgtIFHNeRT
SzKpEuzDpdXPOR4ajPK/fUhQd3F88KeLRlcJXBrogTsXsPhQTaUbRh+1ID7JCJPs
yqHZKlzUBD9TbV5QinyAi8RHyWlykT0scn41tczdB1lPC9VkcobhuCvEqdbqZsTB
JgzvLY2Qi4fQ1JYmw6uIDs1yRjgU/PINGMh11Wh6uUYESuNn8T2aC3vz/AqlfaZm
wwQDT0QnFY69IxPNvTmx6B+38UcYc5/hShGQCHHQDxokd9Ar6JI41OwRbk6qRmlw
TJlAtCkh+YpR+O3zR4sy
=7Jlb
-----END PGP SIGNATURE-----
Hi,
install the package gcc-c++ from Yast
and enjoy
You may also consider building your code in IDE, such as KDevelop or Eclipse
Use root to install gcc with zypper.
once it’s installed, use:
c++ -o *outputFileName* *yourFile.c++*
Next time if you have an idea what the program you want to install is try:
sudo zypper se *programName*
have fun.
And for those who like “make”, here’s something:
# Makefile for C/C++ beginners
#
# This attempts to be a universal / automatic Makefile for small
# C/C++ projects (such as homework / assignments) with automatic
# dependency generation, but without autoconf hassle. The initial
# motivation for this were repeated requests by coderis I tutored
# who could build their projects in Microsoft's IDE, but were
# unable to compile them using 'make' in GNU/Linux.
#
# Send comments to Andreas Stieger <andreas.stieger@gmx.de>
###############################################################
# the compiler commands we use
CC=gcc
CPP=g++
# uncomment this for normal build
# CFLAGS=-Wall -O3
# CPPFLAGS=-Wall -O3
# uncomment this for debug build
CFLAGS=-Wall -g
CPPFLAGS=-Wall -g
# define a basic target "helloworld"
TARGET=helloworld
# define the object files.
# For every class Foo, with files foo.cpp and foo.h, add foo.o here.
OBJS=helloworld.o
###############################################################
LINK=$(CPP) $(CPPFLAGS)
#LINK=$(CC) $(CFLAGS)
LFLAGS=-lm
.SUFFIXES:
.SUFFIXES: .d .o .h .c .cc .cp .cxx .cpp .c++ .CPP .C
.c.o: ; $(CC) $(CFLAGS) -MMD -c $*.c
.cc.o: ; $(CPP) $(CPPFLAGS) -MMD -c $*.cc
.cp.o: ; $(CPP) $(CPPFLAGS) -MMD -c $*.cp
.cxx.o: ; $(CPP) $(CPPFLAGS) -MMD -c $*.cxx
.cpp.o: ; $(CPP) $(CPPFLAGS) -MMD -c $*.cpp
.c++.o: ; $(CPP) $(CPPFLAGS) -MMD -c $*.c++
.CPP.o: ; $(CPP) $(CPPFLAGS) -MMD -c $*.CPP
.C.o: ; $(CPP) $(CPPFLAGS) -MMD -c $*.C
%.d: %.c
touch $@
%.d: %.cc
touch $@
%.d: %.cp
touch $@
%.d: %.cxx
touch $@
%.d: %.cpp
touch $@
%.d: %.c++
touch $@
%.d: %.CPP
touch $@
%.d: %.C
touch $@
DEPENDENCIES = $(OBJS:.o=.d)
all: $(TARGET)
$(TARGET): $(OBJS)
$(LINK) $(FLAGS) -o $(TARGET) $(OBJS) $(LFLAGS)
.PHONY: clean
clean:
-rm -f $(TARGET) $(OBJS) $(DEPENDENCIES) make.dep
make.dep: $(DEPENDENCIES)
-cat $(DEPENDENCIES) > make.dep
include make.dep
Install package gcc-c++
zypper in gcc-c++
then compile your source code, like this
g++ -Wall $(rpm --eval %optflags) file.cpp .........