I'm new to c++ and I'm having some trouble with making a header file. The exact error I'm getting is
obj.obj : error LNK2019: unresolved external symbol "float * __cdecl getVertices(class std::basic_string,class std::allocator >,int,float *)" (?getVertices@@YAPAMV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HPAM@Z) referenced in function "struct ObjModel __cdecl importObj(void)" (?importObj@@YA?AUObjModel@@XZ)
The bugs/solutions I'm seeing seem much more complicated that what I'm doing. Here's my header, which I suspect is wrong.
//obj.h
#ifndef OBJ_H_INCLUDED
#define OBJ_H_INCLUDED
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <fstream>
#include <iostream>
using namespace std;
struct ObjVertex {
float x, y, z;
};
struct ObjTriangle {
int Vertex[3];
int Normal[3];
};
struct ObjModel {
int NumVertex, NumNormal, NumTexCoord, NumTriangle;
ObjVertex *VertexArray;
ObjVertex *NormalArray;
ObjTriangle *TriangleArray;
};
//function prototypes
float* getVertices(string buf, int i, float* ret);
ObjModel importObj();
char* subString(char* buf, int b, int e);
#endif
I've just started in C++ but I have experience in Java and C, so it's probably an issue with me not knowing some C++ specific thing.