Jump to content
  • Advertisement
Sign in to follow this  
benjamin1441

Problem with pointer array

This topic is 5400 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

This is for a mod that I've been trying to program. What happens is that I've defined my pointer array here: Quake.cpp #include <3dmaths.h> etc. CVector3 *g_vWorld; //global pointer array CQuake3::BSPLoader() { g_vWorld[index].x = m_pVerts.vPosition.x; //copying Digiben's g_vWorld[index].y = m_pVerts.vPosition.y; //array into mine g_vWorld[index].z = m_pVerts.vPosition.z; } Then I want to use it in Main.cpp. This is a problem, as I have no idea as to how to do this. I tried: Main.cpp #include <main.h> extern CVector3 *g_vWorld; void RenderLevel() { g_Camera.CheckCamCollision(g_vWorld,m_numOfVerts); } but this doesn't work. How do I do this? Thanks for help, ben

Share this post


Link to post
Share on other sites
Advertisement
My guess would also be that you did not create the memory. Keep in mind also that Quake3 is based on the C language and not C++. To allocate memory in C you must use malloc/calloc. If you are developing within Visual Studio and your file names are .CPP,by they default get compiled in C++. You must have your file names as .C for it to compile in C or you can goto the properties of the file and choose its compile mode.

Share this post


Link to post
Share on other sites
Are you ever including something that will include your cpp file?

Your problem could be as simple as that =)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!