undefined reference to 'nama_class::nama_class'

I was using pascal to learn programming, and I am extremely noob with c++, as I tried to figure out how does the class be placed in separated file on c++, I tried to run the function I've made on the "nama_class.cpp" which just printing texts (a simple program). But, unfortunately I always get an error said " undefined reference to 'nama_class::nama_class' " , i tried change the function's name just to make sure if similarity of the class and the function's name could be the problem. but it getting worst.

here are the codes I have,

main.cpp
1
2
3
4
5
6
7
8
9
#include <iostream>
#include "melon.h"

using namespace std;

int main(){
    nama_class objek1;
    return 0;
    }


melon.h
1
2
3
4
5
6
7
8
9
10
#ifndef MELON_H_INCLUDED
#define MELON_H_INCLUDED

class nama_class{
    public :
    nama_class();
    };

#endif


nama_class.cpp

1
2
3
4
5
6
7
8
#include "melon.h"
#include <iostream>

using namespace std;

nama_class::nama_class(){
cout << "selamat datang di pematang siantar" << endl ;
}


I already have them in the same folders
Last edited on
It looks like file nama_class.cpp was not added to the project.
you're right, I didn't include them as one project. I thought by putting them in a same folder might fixed it, but wrong. That's not it.

I need to find a sub menu "add file(s).." in the project's name tab by right clicking it, then put the cpp and header files in the same project. Thought I need several hours looking for these (-,-;)

Thanks for helping me figuring it out :)
Topic archived. No new replies allowed.