This question already has an answer here:
I am trying to port a Pong program I made in Visual Studios to my raspberry pi. I got everything working perfect In visual studios using a MSP Micro controller.
The Program uses Pigpio on the Pi to connect to the ADC chip. And Open CV for the pong game.
Now I have wired up the MCP3008 ADC and made a new PiControl class instead of my old Control Class.
I started with about 50 errors and I'm slowly getting less and less. I have spent countless hours searching this site and many others to fix all my errors. I would appreciate any help.
The Base Class makes a canvas for the open CV, the ControlPi Class gets two ADC readings from two potentiometers, and the Pong class implements the aspects of the Pong game
Here is my code for 4618_Lab5.cpp :
#include <stdint.h>
#include "stdafx.h"
#include <string>
#include <iostream>
#include <time.h>
#include "Pong.h"
#include "Base4618.h"
#include "ControlPi.h"
#define PI4618
//#define WIN4618
#ifdef WIN4618
#define chOne 0
#define chTwo 1
#include "Control.h"
#include "Serial.h"
#include "opencv.hpp"
#pragma comment(lib,".\\opencv\\lib\\opencv_world310d.lib")
#endif
#ifdef PI4816
#include "ControlPi.h"
#include <opencv2/opencv.hpp>
#endif
int main(int argc, char **argv)
{
CPong pong;
pong.Run();
return 0;
}
Here is my makefile:
# The compiler to use is for C++
CC=g++
# The compiler options are (all warnings)
CFLAGS=-Wall `pkg-config --cflags opencv` -std=c++11 -c
# The linker options are (all warnings)
LDFLAGS=-Wall `pkg-config --libs opencv` -std=c++11 -lpigpio -lrt -lpthread
all: Pong
Pong: 4618_Lab5.o ControlPi.o Base4618.o Pong.o
$(CC) $(LDFLAGS) 4618_Lab5.o ControlPi.o Base4618.o Pong.o -o Pong
4618_Lab5.o: 4618_Lab5.cpp
$(CC) $(LDFLAGS) 4618_Lab5.cpp
ControlPi.o: ControlPi.cpp
$(CC) $(LDFLAGS) ControlPi.cpp
Base4618.o: Base4618.cpp
$(CC) $(LDFLAGS) Base4618.cpp
Pong.o: Pong.cpp
$(CC) $(LDFLAGS) Pong.cpp
The error message I am getting:
make (in directory: /home/pi/Desktop/Lab6/4618_Template) g++ -Wall pkg-config --libs opencv
-std=c++11 -lpigpio -lrt -lpthread 4618_Lab5.cpp /tmp/ccBegQZL.o: In function main': 4618_Lab5.cpp:(.text+0x1c): undefined reference to
CPong::CPong()' 4618_Lab5.cpp:(.text+0x28): undefined reference to CPong::Run()' 4618_Lab5.cpp:(.text+0x38): undefined reference to
CPong::~CPong()' 4618_Lab5.cpp:(.text+0x4c): undefined reference to `CPong::~CPong()' Compilation failed. makefile:14: recipe for target '4618_Lab5.o' failed collect2: error: ld returned 1 exit status make: *** [4618_Lab5.o] Error 1
Aucun commentaire:
Enregistrer un commentaire