I have 6 separate files, named (kInfo.cpp, informationGlobal.h, syscalls.h, syscalls.c, kroc.cpp, kroc.h). While using a make file, one of the files which contains all of the functions I am using and all of the code in the functions (kroc.cpp) is being declared out of scope. This is when calling on functions from the class file which just contains the functions and constructors (kroc.h). I am not quite sure why this is happening, and my implementation is shown below.
I tried using this make file:
CPPFLAGS=-g -pthread -I/sw/include/root
LDFLAGS=-g
CFLAGS=-g -c -Wall -Wextra -Wwrite-strings
kInfo: kInfo.o syscalls.o kroc.o
g++ ${LDFLAGS} -o kInfo kInfo.o syscalls.o kroc.o
kInfo.o: kInfo.cpp informationGlobal.h syscalls.h kroc.h
g++ ${CPPFLAGS} -c kInfo.cpp
proc.o: syscalls.h informationGlobal.h kroc.h
g++ ${CPPFLAGS} -c kroc.cpp
syscalls.o: syscalls.c
g++ ${CFLAGS} syscalls.c
clean:
rm -f *.o
rm -f kInfo
The file kroc.cpp including syscalls.h informationGlobal.h and kroc.h.
The file krocInfo.cpp including kroc.h syscalls.h and informationGlobal.h
The file kroc.h including informationGlobal.h.
I was expecting this to work but I am getting an error that looks like this: error: ‘getPss’ was not declared in this scope; did you mean ‘getpass’. getPss() is a function declared in my kroc.h class.
lhu lhu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.