error LNK2019 I have no idea...

Pages: 12
My task is to get all of my functions pointing to the same Cursor and Colour Controller objects.. hence why all of the errors are similar as they all have the same pointer I think..
Is all of this because of my pointers and maybe I am missing some & or * symbols somewhere?


A linker error indicates that all your code compiled correctly. The linker is simply not finding the functions it states it cannot find. If you're absolutely sure that you're calling those functions correctly (i.e. got the names right and you're feeding them the right kind of parameters) then the problem is not your code.
Unhandled exception at 0x0106219b in week14header.exe: 0xC0000005: Access violation reading location 0xcccccccc.

Happens when I removed that random bit I put into the function.

It builds now, just has lots of these errors....?


Do I need to make new functions for all of my classes which sets the Cursor and Colour Controller pointers?
If I had to guess now, your setup was broken. Changing the cpp files by ramming in bad code forced a recompilation, which then meant fixing the code forced another recompilation, so now the code is being compiled and the linker can find it. In the future, you now know to try "cleaning" the build when you hit these problems, which should be a magic button somewhere in your dev env.

Your linking problems are gone. Now, the problem is your code.

Trying to read location 0xcccccccc indicates that you're trying to dereference a pointer that contains the value 0xcccccccc. Under some dev environments, variables that are never given a value have the value 0xcc in each byte. Clearly, then, you're using a pointer that you never set the value of.

You need to track down which pointer(s) you're trying to use without setting to anything, and set it appropriately. Running in debug mode or whatever your system has should identify for you the bad pointers when you hit them.
Last edited on
Thats the thing. I need all those pointers pointing at the same thing, regardless of their function.
I have added *'s and put -> instead of . operators...

How would I set the position so they all have the same?

Last edited on
1
2
3
4
5
6
7
8
9
int x; // some object
int y; // another object
int* p1; // a pointer
int* p2; //another pointer

p1 = &x; // now p1 points at x
p2 = p1; // now p2 points to the same thing as p1
p1 = &y; // now p1 points to y - p2 is unchanged, so still points to x
p2 = &y; // now p2 also points to y. Could have done p2=p1 instead 

Will I need to give different p1 p2 p3 etc for each function?

I only need all CursorController functions and ColourController objects linked to. But every function/class uses them both.

@OP for questions like this you should probably post your code
I think I know what's the problem becouse It happened to me a LOT! Put all you headers and .cpp files that you use in that program in a PROJECT! All of them in there! That should solve it!
I just put them all in the project, and removed the functions from my file from the other one.
Just has the same runtime errors...
Need to give the pointers locations... Will fiddle on with it and maybe mark this as solved later so you can delete it all soon...
Topic archived. No new replies allowed.
Pages: 12