Undefined symbol: Help please!

Hi all, I am super new to C++ and I am so confused with all the errors I keep getting. I don't seem to be able to locate or figure out how to fix it.

I keep getting
Compiling: main.cpp
Linking console executable: bin/Debug/testomega
Undefined symbols:
"Path::SetJump(int, bool)", referenced from:
_main in main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status


My code is

testomega.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#ifndef testomega_h
#define testomega_h
#include <vector>
using namespace std;

	class Path {
	public:
	 Path(int N){omega.resize(N);
         for (int n=0; n<N; n++) omega[n]=0;}

        vector <bool> omega;
        void SetJump(int n, bool i);
	};

#endif 


testomega.cpp
1
2
3
4
5
6
7
8
9
10
#include <iostream>
#include <vector>
#include "testomega.h"
using namespace std;

    void Path::SetJump(int n, bool i)
            {
                omega[n]=i;
            }
;


main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "testomega.h"
#include <iostream>
#include <cmath>
#include <vector>
#include <cstdlib>

using namespace std;

int main () {

    int N=10;
    Path x(N);

    x.SetJump(1,1);

return 0;
}


Additionally, I originally had
vector <bool> omega;
as
1
2
 Class: Path {
private: vector <bool> omega;}

but then I couldn't access omega after that, so I changed it to a public member. if i wanted it as a private member again, how do I make it work?

I really appreciate any help at all. Thank you so much!

Cheers,
jy
Topic archived. No new replies allowed.