I'm building multiplayer ping pong. So far the movement of the players are good. I am now focusing on the ball movement. So I add tick function which ticks the ball.
The error line is inside main.cpp: (3rd line)(The other 2 are working fine)
client_network_thread_sendto = thread(sendto_network_loop, &running, &me);
client_network_thread_recvfrom = thread(recvfrom_network_loop, &running, &opponent);
client_tick_thread = thread(tick_loop, &me, &opponent, &ball);
The linker:
make
clang++-5.0 -Wall -std=c++11 -Iinclude -g -c src/network.cpp -o build/network.o
clang++-5.0 -Wall -std=c++11 -Iinclude -g -c src/server.cpp -o build/server.o
clang++-5.0 -Wall -std=c++11 -Iinclude -g -c src/geometry.cpp -o build/geometry.o
clang++-5.0 -Wall -std=c++11 -Iinclude -g -c src/player.cpp -o build/player.o
clang++-5.0 -Wall -std=c++11 -Iinclude -g -c src/client.cpp -o build/client.o
clang++-5.0 -Wall -std=c++11 -Iinclude -g -c src/defaults.cpp -o build/defaults.o
clang++-5.0 -Wall -std=c++11 -Iinclude -g -c src/main.cpp -o build/main.o
clang++-5.0 -lglut -lGL -lGLU -lpthread build/network.o build/server.o build/geometry.o build/player.o build/client.o build/defaults.o build/main.o -o bin/main.out
build/main.o: In function `main':
/home/shlomi/Desktop/CPP_OpenGL_Pong_Multiplayer/src/main.cpp:199: undefined reference to `tick_loop(player*, player*, moving_circle*)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:31: recipe for target 'link' failed
make: *** [link] Error 1
client.h:
void sendto_network_loop(bool* running, player* me);
void recvfrom_network_loop(bool* running, player* opponent);
void tick_loop(player* me, player* opponent, moving_circle* ball);
client.cpp: (Implementations)
void tick_loop(player* me, player* opponent, moving_circle* ball) {
ball->tick();
}
I tried to clean and rebuild, searching the same question on the internet, and asking friends.