c++ - Undefined reference to function when linking -
this question has answer here:
trying make c++ program splitting line , creating 2 std::vector save elements said line. function call:
void readconf(const char *name, std::vector<t_objectlibrary> libs, std::vector<iobject *> &objs, std::vector<iobject *> &timer) i placed in inside config.hpp has it's prototype :
void readconf(const char *name, std::vector<t_objectlibrary> libs,std::vector<iobject *> &objs, std::vector<iobject *> timer); and in main call :
int main(int ac, char **av) { std::vector<iobject *> objs; std::vector<iobject *> timer; std::vector<t_objectlibrary> libs; libs = lib_read("./src/objectlibrary"); readconf("config.txt", libs, objs, timer); ... } yet error message when compile makefile. fine until last message of compilation says : 
here makefile use (asked in comments) :
11 │ src = src/getvalue.cpp \ 12 │ src/iobject.cpp \ 13 │ src/attributes.cpp \ 14 │ src/dynamic_lib.cpp \ 15 │ src/config.cpp \ 16 │ src/color.cpp \ 17 │ src/main.cpp 18 │ 19 │ obj = $(src:.cpp=.o) 20 │ 21 │ name = conf 22 │ 23 │ cxx = g++ -std=c++11 -wall -wextra -lsfml-graphics -lsfml-window -lsfml-system -fpic 24 │ 25 │ rm = rm -f 26 │ 27 │ all: $(name) $(obj) 28 │ 29 │ $(name): $(obj) 30 │ $(cxx) $(obj) -o $(name) -ldl 31 │ 32 │ clean: 33 │ $(rm) $(obj) 34 │ 35 │ fclean: clean 36 │ $(rm) $(name) 37 │ 38 │ re: fclean 39 │ 40 │ .phony: clean fclean re
the function signature in hpp doesn't match in declaration.
Comments
Post a Comment