Lesson 22

The Partridge Family were neither partridges nor a family. Discuss.
Psychoman
Posts: 36
Joined: June 13th, 2013, 2:12 pm

Lesson 22

Post by Psychoman » July 30th, 2013, 11:05 am

Hello , when I was watching this lesson and tried to do this stuff ,something terrible happened and gave an error ,that can't be founded in code "Game.obj : error LNK2019: Link unresolved external symbol "void __cdecl LoadSprite(struct Sprite *,char const *,int,int,unsigned long)" (?LoadSprite@@YAXPAUSprite@@PBDHHK@Z). So basically my question is what is this , why is this there, does it refers to image that i'm loading ? And between that a question about pointers( they are so confusing times to times ), where we need to use them ?From my little experience I know that we need to pass adress ( pointer ) , when we have array or object that has big amount information in it ,other things that are small we can pass a value.

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Lesson 22

Post by LuX » July 30th, 2013, 1:48 pm

It means it could not find the declaration of the function. If you write in game.h a function "void myFunc ( );" and then in code try to use it: "myFunc();", but you have not declared it, eg. written first "void Game::myFunc() { return; }" you will get an unresolved external.

Check that you have written the function and make sure you have the "Game::" in front of the function, or where ever it is.

Without seeing the code I can't say for sure.
ʕ •ᴥ•ʔ

Psychoman
Posts: 36
Joined: June 13th, 2013, 2:12 pm

Re: Lesson 22

Post by Psychoman » July 30th, 2013, 2:28 pm

I just changed parametres for the function in header and forgot to change them in cpp , happens =(
and what about pointers?

User avatar
LuisR14
Posts: 1248
Joined: May 23rd, 2013, 3:52 pm
Location: USA
Contact:

Re: Lesson 22

Post by LuisR14 » July 30th, 2013, 5:14 pm

well, what exactly do you not understand about pointers? o,o
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat :mrgreen: --

Psychoman
Posts: 36
Joined: June 13th, 2013, 2:12 pm

Re: Lesson 22

Post by Psychoman » August 1st, 2013, 12:50 pm

I said it in earlier post, mostly the question is situation to use pointers.

User avatar
LuisR14
Posts: 1248
Joined: May 23rd, 2013, 3:52 pm
Location: USA
Contact:

Re: Lesson 22

Post by LuisR14 » August 1st, 2013, 7:26 pm

well they would be used for variables that have been declared in other scopes and to modify the variable's value in functions it is passed to
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat :mrgreen: --

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Lesson 22

Post by chili » August 4th, 2013, 2:27 pm

Yeah, modify variable from other scopes or manipulate blocks of data (arrays).
Chili

Psychoman
Posts: 36
Joined: June 13th, 2013, 2:12 pm

Re: Lesson 22

Post by Psychoman » August 4th, 2013, 8:54 pm

Thanks

Psychoman
Posts: 36
Joined: June 13th, 2013, 2:12 pm

Re: Lesson 22

Post by Psychoman » August 7th, 2013, 9:08 am

Just to know 1 thing , in book , that I read about C ( Deitel ), there're some examples in which they make a variable like char* something[ ... ] and pass this to a function without pointer like
somefunc( char something [...] ). It's just visa versa as chilli does, so I'd like to know , what way is more correct or it's the same thing ?

User avatar
LuisR14
Posts: 1248
Joined: May 23rd, 2013, 3:52 pm
Location: USA
Contact:

Re: Lesson 22

Post by LuisR14 » August 7th, 2013, 7:22 pm

well if you do something like

Code: Select all

char* something[ 5 ];

// pass to somfunc
somefunc( something );
then that wouldn't work since char* something[5] acts as if it were a char**
but this

Code: Select all

char* something[ 5 ];

// pass to somefunc version 1
somefunc( *something );
// or pass to somefunc version 2, x being some pre-declared var lol
somefunc( something[ x ] );
then in that case it would work
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat :mrgreen: --

Post Reply