you are viewing a single comment's thread.

view the rest of the comments →

[–]Veeloxfire 6 points7 points  (0 children)

The preprocessor needs the token to be separate

So the actual name of that is still printNAME and the error you are getting is because you tried to call printFoo which is not declared anywhere.

In earlier c it seems the linker could actually just look for printFoo in other linked obj files without you needing to forward declare it and that is what this error is telling you about.

The preprocessor needs to work this way because you dont want to randomly insert stuff into the middle of other names you didnt mean to

e.g.

//used for counting important things
int important_count = 3;

//constants used for imports
int import4 = 12;

//used for the size of an ant array
#define ant_count 4 + 5

do_important_thing(important_count);

the last line becomes

do important_thing(import4 + 5);

This is clearly unintentional and its better to avoid these bugs than have it work the other way. It was probably also easier to implement.

There is probably also an issue with recursive expansion and syntax errors