Inheriting from class template undefined reference to constructor

I am having trouble with templates and combining them with inheritance, I keep getting an error undefined reference to AssetLoader<Shader*, ShaderLoaderParameter*>::AssetLoader()'. I think there's something I don't quite grasp on templates.


assetloader.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#ifndef ASSETLOADER_H
#define ASSETLOADER_H

#include <iostream>
#include <string>

template<class T, class P>
class AssetLoader
{
	public:
	AssetLoader();
	T virtual load(P loaderparameter) = 0;
};

#endif 

shaderloader.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#ifndef SHADERLOADER_H
#define SHADERLOADER_H

#include "shaderloaderparameter.h"
#include "shader.h"
#include "assetloader.h"
#include <string>

class ShaderLoader : public AssetLoader<Shader*, ShaderLoaderParameter*>
{
	public:
	ShaderLoader() : AssetLoader() {}
	Shader* load(ShaderLoaderParameter* loaderparameter) override;
	~ShaderLoader() {}	
};

#endif 
Last edited on
Looks like you haven't provided a definition of the AssetLoader() constructor.
Last edited on
That was it! Thank you!
Topic archived. No new replies allowed.