Skip to main content
gamedev.net
🔒 Locked

using multiple .cpp files together

Started by jake_Ghost 0 replies 300+ views
Original Post
jake_Ghost
jake_Ghost
i am having some problems using multiple .cpp files. When i declare an instance of a class called BMP in my main cpp in the global sections (rite after all the includes) when i try and use that instance of that class in another .cpp file, it says that it was undefined. And for my BMP class to work i cannot have multiple instances of it because i need to use the data in that class to draw textures and stuff. Any one no how to fix this? thx jake

// MAIN.CPP
#include <windows.h>									// Header File For Windows
#include <math.h>										// Math Library Header File
#include <stdio.h>										// Header File For Standard Input/Output
#include <gl\gl.h>										// Header File For The OpenGL32 Library
#include <gl\glu.h>										// Header File For The GLu32 Library
#include <gl\glaux.h>
#include "DrawScene.h"
#include "BMP.h"

GLDraw GLD;
BMP bmp;

// DRAWSCENE.CPP
void GLDraw::MapTex(const std::string &Filename) const
{
	glBindTexture(GL_TEXTURE_2D, bmp.Texture(Filename));
}

when i compile it get the error that it is not defined!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.