Kishore17 Posted November 6, 2019 Report Share Posted November 6, 2019 Hello Everyone, I have just started to learn system C and I have installed the 2.3.3 version on my linux system 18.04. I have tried installing in usr/local as well as in the local directory (for example : In the downloads itself). I have a very simple hello world program, but i have an error. I feel it is the problem with the installation, any help is highly appreciated. Thank you very much in advance. lugia@celebi:~/SystemC$ make Makefile:56: *** SYSTEMC_HOME [/usr/local/systemc-2.3.3/] is not present. Please update Makefile.config. Stop. lugia@celebi:~/SystemC$ make Makefile:56: *** SYSTEMC_HOME [/usr/local/systemc-2.3.3/] is not present. Please update Makefile.config. Stop. lugia@celebi:~/SystemC$ export SYSTEMC_HOME=/home/lugia/Downloads/systemc-2.3.3/ lugia@celebi:~/SystemC$ make g++ -g -Wall -pedantic -Wno-long-long -Werror -I. -I.. -I/home/lugia/Downloads/systemc-2.3.3//include -c hello.cpp -o hello.o In file included from /home/lugia/Downloads/systemc-2.3.3//include/systemc:74:0, from /home/lugia/Downloads/systemc-2.3.3//include/systemc.h:219, from hello.cpp:1: /home/lugia/Downloads/systemc-2.3.3//include/sysc/kernel/sc_module.h:397:5: error: expected ‘;’ before ‘struct’ struct user_module_name : ::sc_core::sc_module ^ hello.cpp:4:1: note: in expansion of macro ‘SC_MODULE’ SC_MODULE (hello_world) { ^~~~~~~~~ Makefile:109: recipe for target 'hello.o' failed make: *** [hello.o] Error 1 lugia@celebi:~/SystemC$ The error is as stated above. The code is as below. #include <systemc.h> using namespace std SC_MODULE (hello_world) { SC_CTOR (hello_world) { } void say_hello() { cout << "Hello World SystemC-2.3.1.\n"; } }; int sc_main(int argc, char* argv[]) { hello_world hello("HELLO"); hello.say_hello(); return(0); } and my make file is as follows SYSTEMC_HOME?=/home/lugia/Downloads/systemc-2.3.3/ TARGET_ARCH = linux64 FLAGS_COMMON = -g -Wall FLAGS_STRICT = -pedantic -Wno-long-long FLAGS_WERROR = -Werror PROJECT = hello #INCDIR = -I.\ # -I../usaTrackBusSimple OBJS = $(PROJECT).o ## default values for additional setup variables ifneq (,$(strip $(TARGET_ARCH))) ARCH_SUFFIX ?= -$(TARGET_ARCH) endif LDFLAG_RPATH ?= -Wl,-rpath= SYSTEMC_INC_DIR ?= $(SYSTEMC_HOME)/include SYSTEMC_LIB_DIR ?= $(SYSTEMC_HOME)/lib$(ARCH_SUFFIX) SYSTEMC_DEFINES ?= SYSTEMC_CXXFLAGS ?= $(FLAGS_COMMON) $(FLAGS_STRICT) $(FLAGS_WERROR) SYSTEMC_LDFLAGS ?= -L $(SYSTEMC_LIB_DIR) \ $(LDFLAG_RPATH)$(SYSTEMC_LIB_DIR) SYSTEMC_LIBS ?= -lsystemc -lm ## Add 'PTHREADS=1' to command line for a pthreads build ## (should not be needed in most cases) #ifdef PTHREADS #SYSTEMC_CXXFLAGS += -pthread -fPIC #SYSTEMC_LIBS += -lpthread #endif ## *************************************************************************** ## example defaults ## - basic configuration should be set from Makefile.config FILTER ?= cat INCDIR += -I. -I.. -I$(SYSTEMC_INC_DIR) LIBDIR += -L. -L.. CXXFLAGS += $(CFLAGS) $(SYSTEMC_CXXFLAGS) $(INCDIR) $(SYSTEMC_DEFINES) LDFLAGS += $(CFLAGS) $(SYSTEMC_CXXFLAGS) $(LIBDIR) $(SYSTEMC_LDFLAGS) LIBS += $(SYSTEMC_LIBS) $(EXTRA_LIBS) # "real" Makefile needs to set PROJECT ifeq (,$(strip $(PROJECT))) $(error PROJECT not set. Cannot build.) endif # basic check for SystemC directory ifeq (,$(wildcard $(SYSTEMC_HOME)/.)) $(error SYSTEMC_HOME [$(SYSTEMC_HOME)] is not present. \ Please update Makefile.config) endif ifeq (,$(wildcard $(SYSTEMC_INC_DIR)/systemc.h)) $(error systemc.h [$(SYSTEMC_INC_DIR)] not found. \ Please update Makefile.config) endif ifeq (,$(wildcard $(SYSTEMC_LIB_DIR)/libsystemc*)) $(error SystemC library [$(SYSTEMC_LIB_DIR)] not found. \ Please update Makefile.config) endif ## *************************************************************************** ## build rules .SUFFIXES: .cc .cpp .o .x GOLDEN?=$(firstword $(wildcard ../results/expected.log golden.log)) EXEEXT?=.x EXE := $(PROJECT)$(EXEEXT) all: announce build announce: @if test x1 = x$(FLAG_BATCH) ; then \ echo; echo "*** $(PROJECT):"; echo; \ fi check: announce all @if test -f "$(INPUT)" ; then INPUT="< $(INPUT)" ; fi ; \ eval "$(VALGRIND) ./$(EXE) $(ARGS) $${INPUT} > run.log" @cat run.log | grep -v "stopped by user" | \ $(FILTER) | awk '{if($$0!="") print $$0}' > run_trimmed.log @if test -f "$(GOLDEN)" ; then \ cat "$(GOLDEN)" | grep -v "stopped by user" | \ awk '{if($$0!="") print $$0}' > ./expected_trimmed.log ; \ diff ./run_trimmed.log ./expected_trimmed.log > diff.log 2>&1 ; \ if [ -s diff.log ]; then \ echo "***ERROR:"; cat diff.log; \ else echo "OK"; fi \ fi run: announce all @if test -f "$(INPUT)" ; then INPUT="< $(INPUT)" ; fi ; \ eval "./$(EXE) $(ARGS) $${INPUT}" build: announce $(EXE) $(EXE): $(OBJS) $(SYSTEMC_LIB_DIR)/libsystemc.a $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) 2>&1 | c++filt @test -x $@ .cpp.o: $(CXX) $(CXXFLAGS) -c $< -o $@ .cc.o: $(CXX) $(CXXFLAGS) -c $< -o $@ clean:: announce rm -f $(OBJS) $(EXE) core $(EXTRA_CLEAN) \ run.log run_trimmed.log expected_trimmed.log diff.log ultraclean: announce clean rm -f Makefile.deps *~ #Makefile.deps: # $(CXX) $(CXXFLAGS) -M $(SRCS) >> Makefile.deps #include Makefile.deps Quote Link to comment Share on other sites More sharing options...
Roman Popov Posted November 7, 2019 Report Share Posted November 7, 2019 You forgot ";" here: using namespace std; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.