[Solved]Compiler error: Undefined symbols for arhcitecture x86_64
-
Hello,
I got a pretty nasty error when I wrote a new function today. I use it in several places in a program, so I've put that function in a separate file which I include when I need it.
I want this function to be dynamic do some extend so I used a template for one of the parameters, which I think is the cause of all my problems.Probably I don't make much sense, so I hope the code bellow will shed the light on this more than I did.
file_structures.h - this is where function header is at
@#ifndef FILE_STRUCTURES_H
#define FILE_STRUCTURES_H#include <string.h>
#include "globals.h"/...
irrelevant code here
.../template <class type_of_element>
bool generate_manifest_file(short type, type_of_element element[], int n, RProject project_data);#endif // FILE_STRUCTURES_H
@file_structures.cpp - whole definition (function's body)
@#include "file_structures.h"
#include "level_elements.h"/...
irrelevant code here
.../template <class type_of_element>
bool generate_manifest_file(short type, type_of_element element[], int n, RProject project_data)
{
// CODE
}
@projectcontrol.cpp - this is where I actually use/call this function
@#include "globals.h"
#include "file_structures.h"/...
irrelevant code here
.../
void handleFileGeneration()
{
/...
irrelevant code here
.../
if(!generate_manifest_file(0, test_element, 3, current_project))
qDebug() << "ERROR!";
else
qDebug() << "YEY!";
}/...
irrelevant code here
.../
@And of course also compiler output shouldn't hurt also:
@Undefined symbols for architecture x86_64:
"bool generate_manifest_file<terrain_tile>(short, terrain_tile*, int, RProject)", referenced from:
ProjectControl::handleElementImport() in projectcontrol.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
@And for additional info:
I'm using Mac version of Qt 5.1.0,
working on OS X 10.8.4,
compiling with GCC / G++ version: 4.2.1,
and no I am not using any external libraries expect for those already build in Qt.Thank you, for reading through all this mess,
Yahara