Archived

This topic is now archived and is closed to further replies.

Pointers, pointers, pointers

This topic is 5431 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to create a class so I can generate a link list of primary and secondary buffers for each window of my app but I'm having a hard time manageing all the pointers, please take a look at the code below. Any help would be great. class myClass { public: myClass(){g_pDS = NULL;}; freind myClass *NewInterface(long hWindow); protected: IDirectSound8 *g_pDS; //Rest of info on buffer myClass *Next; } myClass *NewInterface(long hWindow) { myClass *NewInt; NewInt = new myClass; DirectSoundCreate8(NULL, &(NewInt->g_pDS), NULL); // heres the problem it wont recognize a pointer to a pointer to a member that is a pointer if you know what I mean // rest of code to initialize the primary buffer return NewInt; } [edited by - NRMStudios on January 30, 2003 6:21:15 AM]

Share this post


Link to post
Share on other sites
At first glance, that looks okay. What error are you getting?


Don''t listen to me. I''ve had too much coffee.

Share this post


Link to post
Share on other sites
You have declared a friend function to the class myClass named:
myClass *NewInterface(long hWindow);

But that friend function is not the same as the function named:
void NewInterface(long hWindow);

Change the return type of the second function to myClass* instead of void and it should work.



Update GameDev.net system time campaign: ''date ddmmHHMMYYYY''

Share this post


Link to post
Share on other sites
quote:
Original post by dalleboy
You have declared a friend function to the class myClass named:
myClass *NewInterface(long hWindow);

But that friend function is not the same as the function named:
void NewInterface(long hWindow);

Change the return type of the second function to myClass* instead of void and it should work.



Update GameDev.net system time campaign: ''date ddmmHHMMYYYY''


Sorry this was a minor over sight on my part but not the cause of the error.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Sneftel
At first glance, that looks okay. What error are you getting?

<hr>Don''t listen to me. I''ve had too much coffee.


the problem is in the line:


DirectSoundCreate8(NULL, &(NewInt->g_pDS), NULL);


The error get is a linking error of some sort and when I try:


DirectSoundCreate8(NULL, NewInt->g_pDS, NULL);


I get an error something like: error arguement 2 I''''l print the exact messages when I get home.

Share this post


Link to post
Share on other sites
quote:
Original post by Sneftel
At first glance, that looks okay. What error are you getting?


Don''t listen to me. I''ve had too much coffee.


the problem is in the line:


DirectSoundCreate8(NULL, &(NewInt->g_pDS), NULL);


The error get is a linking error of some sort and when I try:


DirectSoundCreate8(NULL, NewInt->g_pDS, NULL);


I get an error something like: error arguement 2 I''''l print the exact messages when I get home.

Share this post


Link to post
Share on other sites
quote:

the problem is in the line:

DirectSoundCreate8(NULL, &(NewInt->g_pDS), NULL);

The error get is a linking error of some sort



That is the correct way to call it. What is the linking error? Are you linking to the directx libs in your project?

Share this post


Link to post
Share on other sites
Yeah I am writting it the correct way. I tried it with out all the fancy pointers and get the same linking error listed below:


[Linker error] undefined reference to `DirectSoundCreate8@12''

Share this post


Link to post
Share on other sites
You need to add "dinput8.lib" to your list of link libraries and make sure the DirectX SDK lib directory is in your library path.

[edited by - fizban75 on January 30, 2003 5:46:41 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by NRMStudios
Nos Obligatus Peto Veritas


Errr... I think you mean "Petere Veritatem Debemus".


Don''t listen to me. I''ve had too much coffee.

Share this post


Link to post
Share on other sites
What I''m trying to say is that; we are obligated to seek the truth. So I just used an online translator and thats what it spit out. What does "Petere Veritatem Debemus" translate to?

Share this post


Link to post
Share on other sites
It means "We are obliged to seek the truth", which is what I assumed you meant. The sentence you had is more or less meaningless, but would be best translated as "The truth we were obliged I seek".


Don''t listen to me. I''ve had too much coffee.

Share this post


Link to post
Share on other sites