Undefined symbols for architecture x86_64
-
Ob.hpp
#ifndef Ob_hpp #define Ob_hpp
#include <stdio.h>
class Ob
{
public:
Ob(void);
public:
~Ob(void);
virtual void Show()=0;
};#endif /* Ob_hpp */
PAIR.hp
#ifndef PAIR_hpp
#define PAIR_hpp#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include "Ob.hpp"
using namespace std;class PAIR : public Ob
{
public:
PAIR(void);
public:
virtual ~PAIR(void);
void Show();
PAIR(int, int);
PAIR(const PAIR&);int get_first(){return first;} int get_second(){return second;} void set_first(int); void set_second(int); PAIR& operator=(const PAIR&); void operator>(const PAIR&); void operator<(const PAIR&); void operator==(const PAIR&); void operator!=(const PAIR&); friend istream& operator>>(istream&in, PAIR&c); friend ostream& operator<<(ostream&out, const PAIR&c);
protected:
int first;
int second;
};
#endif /* PAIR_hpp */
Error:
Undefined symbols for architecture x86_64:
"Ob::Ob()", referenced from:
PAIR::PAIR() in PAIR.o
PAIR::PAIR(int, int) in PAIR.o
PAIR::PAIR(PAIR const&) in PAIR.o
"Ob::~Ob()", referenced from:
PAIR::~PAIR() in PAIR.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
There's such errors in the compilation, if you leave only Class PAIR, that's, "public Ob" to clean up, it's working.
-
The contact editor does not see the definition of default designer
Ob
♪You announced it.
class Ob { public: Ob(void); //...
but they either forgot to identify or have not connected the project file where the designer is defined.