I have a class ABC in C++ .h class file.
.h file
#ifndef ABC_H_
#define ABC_H_
class ABC
{
public:
int x;
int y;
};
#endif
.cpp file
//----- Empty -----------
Main program .cpp
#include <iostream>
#include "ABC.h"
using namespace std;
int main() {
ABC a1;
a1.x=5; a1.y=2;
cout<<a1.x;
// ...
}
Error during compiling in Eclipse:
symbols not found for architecture x86_64
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [CPPProgram] Error 1
All the other hello world programs etc. compile and run fine. I remember facing this error coming when I did the definition and implementation in separate files while using templates (and it went away when I implemented the definition and the implementation in same file)
I am not sure about what’s wrong here. Any suggestions?
In the code you posted, you are missing a semi-colon: