-1

Trying to make a c++ program splitting a line and creating 2 std::vector to save elements from said line. This is the function I 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 which has it's prototype :

void readConf(const char *name, std::vector<t_objectLibrary> libs,std::vector<IObject *> &objs, std::vector<IObject *> timer);

and in the main I call it like this :

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 I get this error message when I compile with the Makefile. Everything is fine until the last message of compilation it says this : enter image description here

Here is the Makefile I use (Asked in the 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 all
39 │ 
40 │ .phony: all clean fclean re
Romain
  • 27
  • 3
  • Not "Hyperlink", i wanted to type "Link" or "Linking", sorry – Romain Mar 17 '16 at 09:36
  • 3
    Do you actually define `readConf` somewhere and link against the object file containing the definition? – TartanLlama Mar 17 '16 at 09:38
  • Veronika Prüssels, yes it does compile as you say it just doesn't link. TartanLlama yes I define readConf() in config.hpp that I call in config.cpp AND in main.cpp – Romain Mar 17 '16 at 09:46

2 Answers2

2

The function signature in the hpp doesn't exactly match that in the declaration.

0

For further reading, consider another SO thread. In your case, perhaps, a typo (check method signature in hpp). hth

Community
  • 1
  • 1
mnemonic
  • 1,605
  • 2
  • 17
  • 26