Pointers, pointers, pointers

Started by
12 comments, last by NRMStudios 21 years, 2 months ago
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]
Nos Obligatus Peto Veritas
Advertisement
At first glance, that looks okay. What error are you getting?

Don''t listen to me. I''ve had too much coffee.
What is the specific error message?
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''
Arguing on the internet is like running in the Special Olympics: Even if you win, you're still retarded.[How To Ask Questions|STL Programmer's Guide|Bjarne FAQ|C++ FAQ Lite|C++ Reference|MSDN]
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.
Nos Obligatus Peto Veritas
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.
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.
Nos Obligatus Peto Veritas
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?
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''
Nos Obligatus Peto Veritas
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]

This topic is closed to new replies.

Advertisement