I have 3 projects: Server, Client and Commons. Making header & source pairs in Commons doesn't cause any problems and I can access the functions freely from both Server and Client.
However, for some reason making additional source/header files within Server or Client project always causes multiple definition of (...)
and first defined here
errors.
Example:
commands.h (in root dir of the Client project)
#ifndef COMMANDS_H_
#define COMMANDS_H_
#include "commands.c"
void f123();
#endif /* COMMANDS_H_ */
commands.c (in root dir of the Client project)
void f123(){
}
main.c (in root dir of the Client project)
#include "commands.h"
int main(int argc, char** argv){
}
Errors:
make: *** [Client] Error 1 Client
first defined here Client
multiple definition of `f123' commands.c
Cleaning, rebuilding index, rebuilding projects doesn't help. Neither does restarting the computer.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…