Reputation: 1448
I am trying to pass a object reference from a function on the main method. I think the problem lies in there.
In java I would do something like this:
Object obj;
theFunction(obj);
the method definition would be like:
public void theFunction(Object obj) {
obj.useMethod();
}
What I did on c++ was:
void theFunction(Object& obj){
obj.useMethod();
}
This way is what I believe is correct accordingly to what I have been reading on the subject. I am using visual studio 2013 and it does not complain, only when I compile. The error message is as follows:
1>------ Build started: Project: Radiosity, Configuration: Debug Win32 ------
1> Source.cpp
1>Source.obj : error LNK2019: unresolved external symbol "public: void __thiscall Keyboard::specialKeys(class Camera &)" (?specialKeys@Keyboard@@QAEXAAVCamera@@@Z) referenced in function "void __cdecl display(void)" (?display@@YAXXZ)
1>C:\Users\PC\Documents\Visual Studio 2013\Projects\Radiosity\Debug\Radiosity.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Upvotes: 0
Views: 188
Reputation: 617
I would double check the links to the libraries. The code looks fine to me. I had a hell of a time setting up an OpenGL context the first time I started using it.
Also check out these pages on the specific errors:
http://msdn.microsoft.com/en-us/library/799kze2z.aspx
http://msdn.microsoft.com/en-us/library/z98k84c3.aspx
Upvotes: 0
Reputation: 5674
You are having a linkage error.
Keyboard::specialKeys()
is somewhere declared on your code. So it means, you are using a correct header file when compiling your code. But you are not linking to the correct library.
Which library does Keyboard::specialKeys()
comes from? You need it in order to correct the linkage of your program.
In Visual Studio, right click on your project and go to the Project Settings (or something like), then
Configuration Properties -> Linker -> Input -> Additional Dependences
Add in this field the correct library file. A .lib file corresponding to the Keyboard::specialKeys()
Upvotes: 2