0

When I compile I get a set of strange errors. This is what i compile with first. (This is generated from my makeFile.)

gcc -Wall -g -std=gnu99 -pedantic -c error.c -o error.o gcc -Wall -g -std=gnu99 -pedantic -c agent.c -o agent.o gcc -Wall -g -std=gnu99 -pedantic -c io.c -o io.o gcc -Wall -g -std=gnu99 -pedantic -c map.c -o map.o 

Then it comes down to linking it all together with my handler; I use this:

gcc -Wall -g -std=gnu99 -pedantic error.o agent.o io.o map.o handler.c -o handler 

and it outputs a message that I cant find info about. Any ideas?

Undefined symbols for architecture x86_64: "_m", referenced from: _print_map in io.o _read_map in io.o _check_row in map.o _get_start_pos in map.o _move_one_step in map.o _displayMoveOnMap in map.o _reset_map in map.o ... (maybe you meant: _reset_map, _move_one_step , _print_map , _read_map , _main ) 

I think it's just a little Makefile tweak but I can't find much on these errors.

5
  • Are print_map(), read_map() etc your code? Looks like a missing object file. Commented Sep 26, 2013 at 22:49
  • @John3136 yeah they are all in my code. declared in the headers ect I thought i was linking them up to the handler ? Commented Sep 26, 2013 at 23:01
  • How did you write so much code without testing it? Commented Sep 26, 2013 at 23:05
  • Please don't add "[SOLVED]" to the title of your question. That's indicated simply by accepting an answer (which you've done). Commented Sep 26, 2013 at 23:38
  • Ok, sorry about that. Cheers @KeithThompson Commented Sep 26, 2013 at 23:41

1 Answer 1

1

Sounds like you've got an extern m (I don't know what type, or even if it is a function) in both io.c and map.c, but not defining it anywhere. I'd look for the extern declaration in map.h, although that's just a guess.

Sign up to request clarification or add additional context in comments.

1 Comment

Hi it was this problem and then it came up to a duplicate declaration warning, did abit of searching and for some reason i was declaring a struct NULL in the header. Thank you so much @rici

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.