death_oclock 103 Posting Whiz

note that *(glblclrtab + i) is functionally equivalent to glblclrtab but the second is way easier to read.

Not entirely true, it is possible that the array was broken up in memory (to save space, or maybe just to piss programmers off). The first approach will not account for that, the second will. Plus, if you used the first, you have to be careful of accounting for the size of each array element.

death_oclock 103 Posting Whiz

Umm, that sounded pretty unnecessary. Try:

printf("row %d sum = %d\n", r + 1, tot);

Keep the loops the same. It will start the labeling at 1 (0 + 1) and go to 3 (2 + 1).

death_oclock 103 Posting Whiz

You can't put a button into a console. The only way to parse mouse event in one is using a bizarre Windows-specific process. You would need to use the Windows API for something like that, and it's way too much for a beginner. Try visual basic.

death_oclock 103 Posting Whiz

printf("\r");

It may be compiler-specific, it may be platform dependent, so use discretion but give it a try.

death_oclock 103 Posting Whiz

Agreed. Just a wild guess, if you're using Windows, check out DirectSound (msdn, google search will serve you well). But this of course would come after substantial knowledge and experience with the language.

death_oclock 103 Posting Whiz

You are passing in to set_add variable that don't exist yet! In the beginning of your main, declare them like this:

string St_address;
string city, state;
int Zip;

Although your code was sort of hard to understand, the prototype for set_add said it was a mutator. But the way you wrote it, the object is never modified. If your goal was to set the object's values to user input, daviddoria's solution is the one to choose.

death_oclock 103 Posting Whiz

I am making some software to analyze digital sound data. My first step is to find where all the attacks are, or where the starts of notes are. I want to find where there is a significant increase in volume, working with both relative and absolute differences. The difficulty with this is that the volume varies with each sample (fluctuation is what causes the sound itself).

I have a few ideas. I was thinking of taking various sets of samples, maybe ten or so, and taking the average of those. Then take an adjacent set (possibly overlapping) and comparing the two averages. Alternatively, I could compare maximums of the sets. Or maybe I don't need sets, but I could just ignore the low samples and compare only the high points?

I was hoping someone could offer some advice, web articles, or experience. Anything will be greatly appreciated.

death_oclock 103 Posting Whiz

It would seem my .x file was invalid. It works fine with another file I downloaded...

death_oclock 103 Posting Whiz

Several database servers (mySQL, for example) include libraries and headers for C that allow programs to access databases. You should easily be able to find a tutorial on how to do it with your choice of server.

death_oclock 103 Posting Whiz

I have the following globals defined (the relevant ones, anyway):

DWORD dwNumMaterials;
LPD3DXBUFFER lpMaterials;
LPD3DXMESH lpMeshBody;

And the call to D3DLoadMeshFromX is here:

D3DXLoadMeshFromX(L"body.x",
		  D3DXMESH_SYSTEMMEM,
		  lpD3DDevice,
		  NULL,
		  &lpMaterials,
		  NULL,
		  &dwNumMaterials,
		  &lpMeshBody);

When this is called, it returns a generic error (0x80004005). Also, if it is needed I can post more code. Any ideas on what I did wrong? And yes, body.x does exist in the program's path.

death_oclock 103 Posting Whiz

I just did and all tests were successful.

death_oclock 103 Posting Whiz

I have the following globals defined (the relevant ones, anyway):

DWORD dwNumMaterials;
LPD3DXBUFFER lpMaterials;
LPD3DXMESH lpMeshBody;

And the call to D3DLoadMeshFromX is here:

D3DXLoadMeshFromX(L"body.x",
		  D3DXMESH_SYSTEMMEM,
		  lpD3DDevice,
		  NULL,
		  &lpMaterials,
		  NULL,
		  &dwNumMaterials,
		  &lpMeshBody);

When this is called, it returns a generic error (0x80004005). Also, if it is needed I can post more code. Any ideas on what I did wrong? And yes, body.x does exist in the program's path.

death_oclock 103 Posting Whiz

I am making a blitting call on my backbuffer:

BOOL drawImage(IMAGE *lpImage, LONG x, LONG y)
{
	RECT rect;

	rect.left = x;
	rect.top = y;
	rect.right = x + lpImage->lWidth;
	rect.bottom = y + lpImage->lHeight;

	dwVideoErrCode = lpBack->Blt(&rect, lpImage->lpSurface, NULL, DDBLT_WAIT | DDBLT_KEYSRC, NULL);
	if(dwVideoErrCode != DD_OK)
	{
		MessageBox(NULL, L"Failed to blit image to backbuffer.", L"Error!", MB_ICONEXCLAMATION | MB_OK);
		return FALSE;
	}

	return TRUE;
}

Blt() fails and return the error code -2005532242 or 0x887601ae in hexadecimal.
My problem is that I can't find out what this code means because Microsoft decided not to list DirectDraw return values by number. If anyone could find out what this error is supposed to be, that would really help me out in fixing the problem.

Solution: I found a site with source code to dxerr.c, which listed all the return values and their numeric values. Apparently my error is DDERR_SURFACEBUSY

death_oclock 103 Posting Whiz

Ooops, I just found out that 8-bit mode has to be palletized, so the macro is actually coming up with an arbitrary index to a color in the default pallet.

death_oclock 103 Posting Whiz

I am using DirectDraw to make a game and I am running it in 8-bit color mode. What I am having a problem with is making a macro to convert RGB values into a single 8-bit color.
Here is the macro:

#define RGB_8BIT(r, g, b) ((r & 224) + ((g & 224) >> 3) + (b >> 6))

Here's my setPixel function:

VOID setPixel(INT x, INT y, BYTE color)
{
	lpScreen[x + y * lPitch] = color;
}

lpScreen is defined as an array of BYTEs.
And here is the implementation in WinMain:

setPixel(0, 0, RGB_8BIT(255, 0, 0));

For some reason, this comes out as a greenish-blue when it should be pure red.

death_oclock 103 Posting Whiz

I kind of thought as much. Well thanks anyway.

death_oclock 103 Posting Whiz

I need to find the number of elements in an array passed into a function. The problem is in this case, sizeof() returns the size of the pointer itself. It only does this when passed through to a function. So here is that function:

bool matchWord(TWORD *wordList, TWORD *word, char *str)
{
	for(int i = 0; i < sizeof(wordList) / sizeof(wordList[0]); i++)
	{
		if(_stricmp(wordList[i]->str, str) == 0)
		{
			word->str = wordList[i].str;
			word->id = wordList[i].id;
			word->pos = wordList[i].pos;
			return true;
		}
	}
	return false;
}

Here is the array definition if you need to look at it:

TWORD *wordList = new TWORD[2];
wordList[0].setValues("move", WORD_MOVE, POS_VERB, -1);
wordList[1].setValues("north", WORD_NORTH, POS_NOUN, -1);

And although you really shouldn't need to look at is for this problem, here is the definition of the TWORD class:

class TWORD
{
	public:
		char *str;
		int id;
		int pos;
		int index;

		TWORD();
		TWORD(char *str, int id, int pos, int index);
		void setValues(char *str, int id, int pos, int index);
		char *posToString();
		char *toString();
};

TWORD::TWORD()
{
	this->str = NULL;
	this->id = 0;
	this->pos = 0;
	this->index = -1;
}

TWORD::TWORD(char *str, int id, int pos, int index)
{
	this->str = str;
	this->id = id;
	this->pos = pos;
	this->index = index;
}

void TWORD::setValues(char *str, int id, int pos, int index)
{
	this->str = str;
	this->id = id;
	this->pos = pos;
	this->index = index;
}

char *TWORD::posToString()
{
	switch(this->pos)
	{
		case POS_NOUN:
		{
			return "noun";
		} break;
		case POS_VERB:
		{
			return "verb";
		} break;
	}
	return "unknown"; …
death_oclock 103 Posting Whiz

Here's the important segment of the array duplicates problem:

for(int i = 0; i < 1000; i++)
{
    for(int j = 0; j < 1000; j++)
    {
        if(i != j)
        {
            if(arr[i] == arr[j])
            {
                return arr[i];
            }
        }
    }
}

This just checks every element of the array against every other element of the array.
Wow, those were some pretty ridiculous algorithms you guys came up with.

death_oclock 103 Posting Whiz

Sorry ssharish, Dave posted before I did and I didn't notice it so I edited my post rather than making another. His suggestion fixed my problem.

death_oclock 103 Posting Whiz

Oh, thanks Dave! I wasn't sure about those typedef statements, I actually just saw that type of thing somewhere and copied the idea. Thank you very much.

death_oclock 103 Posting Whiz

I'm a referring to the original post here:

On this line:

pair[k]=atoi(&argv[i]);

You are actually passing in a pointer to a pointer while the function only takes a pointer. Remove the '&', this is whats causing a problem.

death_oclock 103 Posting Whiz

Maybe you should have read some of the forum rules: we aren't going to "give you" the code. Then you aren't learning which kind of defeats the point, right? Jishnu gave you an excellent tutorial to read, I was just about to suggest a bubble sort myself. Once you understand the basic algorithm, you can apply it to entire strings. I would suggest using the strcmp() function which is part of the cstring.h header because it will tell you which string is "larger" alphabetically.

death_oclock 103 Posting Whiz

Lets please not have everyone get so offended here. Some of you people really need to chill out. In response to the code: When calling a function, you don't include data types. You simply pass in the variables you want the function to use. Although I would recommend doing some reading on pointers as they are a crucial aspect of C. Here's tutorial I really liked as it's very thorough: http://www.iu.hio.no/~mark/CTutorial/CTutorial.html You can skip to the sections on pointers if you wish.

death_oclock 103 Posting Whiz

In C, you can use the char data type just like a number and it will automatically convert it to the ASCII value. Here's a minimal example:

int myNum = 'a';

myNum would have the value 97 in it.

death_oclock 103 Posting Whiz

I would make an array of strings, one element for each line. Than use something like getchar() to read in one character at a time until you find a '\n' (newline) character. Then start using the next element and read in the next line likewise until you reach the end of the file.

death_oclock 103 Posting Whiz

I'm not all that familiar with the C syntax rules, I've mostly worked with C++, and I'm having some weird problems working with Visual C 2008. Here's my code:

#ifndef IFF_H
#define IFF_H

#include <stdio.h>
#include <stdlib.h>

#define IDS_GROUP ""
#define IDN_GROUP 1
#define IDS_CAT "cat "
#define IDN_CAT 2
#define IDS_LIST "list"
#define IDN_LIST 4
#define IDS_PROP "prop"
#define IDN_PROP 8
#define IDS_FORM "form"
#define IDN_FORM 16
#define IDS_RIFF "riff"
#define IDN_RIFF 32

typedef struct GROUP *GROUP;
typedef struct CHUNK *CHUNK;

struct CHUNK
{
	//GROUP *__parent;
	char *chunkID;
	unsigned long size;
	char *data;
};

struct GROUP
{
	GROUP *__parent;
	char *typeID;
	unsigned long remainingSize;
	char *groupID;
	GROUP *cats;
	int nCats;
	GROUP *lists;
	int nLists;
	GROUP *props;
	int nProps;
	GROUP *forms;
	int nForms;
	CHUNK *chunks;
	int nChunks;
};

void groupCon(GROUP *group);
void groupDes(GROUP *group);
void chunkCon(CHUNK *chunk);
void chunkDes(CHUNK *chunk);

void groupCon(GROUP *group)
{
	group->__parent = NULL;
	group->typeID = (char *)malloc(4);
	group->remainingSize = 0;
	group->typeID = (char *)malloc(4);
	group->cats = (GROUP *)malloc(0);
	group->nCats = 0;
	group->lists = (GROUP *)malloc(0);
	group->nLists = 0;
	group->props = (GROUP *)malloc(0);
	group->nProps = 0;
	group->forms = (GROUP *)malloc(0);
	group->nForms = 0;
	group->chunks = (CHUNK *)malloc(0);
	group->nChunks = 0;
}

void groupDes(GROUP *group)
{
	int i;
	for(i = 0; i < sizeof(group->cats) / sizeof(GROUP); i++)
	{
		groupDes(&group->cats[i]);
	}
	for(i = 0; i < sizeof(group->lists) / sizeof(GROUP); i++)
	{
		groupDes(&group->lists[i]);
	}
	for(i = 0; i < sizeof(group->props) / sizeof(GROUP); i++)
	{
		groupDes(&group->props[i]);
	}
	for(i = 0; i < sizeof(group->forms) / sizeof(GROUP); i++)
	{
		groupDes(&group->forms[i]);
	}
	for(i …
death_oclock 103 Posting Whiz

I solved this myself. I'm not sure why the file idea didn't work, but going back to the pipes idea, I just passed the console the wrong handles. For any others having the problem, make sure you give it the stdInRead handle, and the stdOutWrite and stdErrWrite handles.

death_oclock 103 Posting Whiz

In that case, I'm sorry but I don't know what to tell you. Usually those errors are from missing .lib files but if none were included I have no clue.

Edit: Are there any .a files? Because that is another form of library.

death_oclock 103 Posting Whiz

I should also mention that if I leave out the STARTF_USESTDHANDLES flag in the STARTUPINFO structure, it works fine (except that, obviously, the i/o isn't redirected).

death_oclock 103 Posting Whiz

You could use the WinAPI file functions (http://msdn2.microsoft.com/en-us/library/aa364232(VS.85).aspx) which allow you to set sharing permissions (as well as other flags and such for the sort of thing you described).

death_oclock 103 Posting Whiz

When you downloaded the header files, they most likely came with some library files, judging by those errors. You just have to let visual studio know about those files via the method I mentioned before. It probably wouldn't matter too much if you added library files that weren't necessary, so don't hesitate to just add them all (all that came with the headers).

death_oclock 103 Posting Whiz

He didn't mean you should change it to 0, he meant thats what your code equated to. He meant you should either set or prompt for a product number. The first product in the display is still zero because you started your loops at 1, therefore skipping the 0th element of the array (the one that actually had a value). This is also why there are only 6 days in the week and 4 products.

death_oclock 103 Posting Whiz

This looks like it requires some library files that you didn't add. Go to the project settings, go to Configuration Properties->Linker->Input->Additional Dependencies. Add any .lib files you find with the other twofish files in this field. You may have to add the folder they're in to Configuration Properties->Linker->General->Additional Library Dependencies. Also, I'm not sure of your file organization or if you have any other files, but I don't see a main() function anywhere. That could cause your last error.

death_oclock 103 Posting Whiz

I'm writing a program that opens another console application with redirected input and output handles. I don't get any errors when I run this, but the console closes immediately, despite the system("pause") at the end. With the current solution, I have it redirecting to files, but another solution using pipes (commented out) yielded the same results. Here is the relevant code:

edit: I should mention that hStdIn, hStdOut, hStdErr, and hChildProcess are globally defined handles.

BOOL createProcess(WCHAR commandLine[])
{
	//HANDLE hStdInRead;
	//HANDLE hStdInWriteTmp;
	//HANDLE hStdOutWrite;
	//HANDLE hStdOutReadTmp;
	//HANDLE hStdErrWrite;
	//HANDLE hStdErrReadTmp;
	SECURITY_ATTRIBUTES sa;
	STARTUPINFO si;
	PROCESS_INFORMATION pi;

	ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES));

	/*sa.nLength = sizeof(SECURITY_ATTRIBUTES);
	sa.bInheritHandle = TRUE;

	if(!CreatePipe(&hStdInRead,
				   &hStdInWriteTmp,
				   &sa,
				   0))
	{
		error(L"Failed to create stdin handle.");
		return FALSE;
	}

	if(!CreatePipe(&hStdOutReadTmp,
				   &hStdOutWrite,
				   &sa,
				   0))
	{
		error(L"Failed to create stdout handle.");
		return FALSE;
	}

	if(!CreatePipe(&hStdErrReadTmp,
			   &hStdErrWrite,
			   &sa,
			   0))
	{
		error(L"Failed to create stderr handle.");
		return FALSE;
	}

	// create non-inheritable duplicates of the handles

	if(!DuplicateHandle(GetCurrentProcess(),
						hStdInWriteTmp,
						GetCurrentProcess(),
						&hStdIn,
						NULL,
						FALSE,
						DUPLICATE_SAME_ACCESS))
	{
		error(L"Failed to duplicate stdin handle.");
		return FALSE;
	}

	if(!DuplicateHandle(GetCurrentProcess(),
						hStdOutReadTmp,
						GetCurrentProcess(),
						&hStdOut,
						NULL,
						FALSE,
						DUPLICATE_SAME_ACCESS))
	{
		error(L"Failed to duplicate stdout handle.");
		return FALSE;
	}

	if(!DuplicateHandle(GetCurrentProcess(),
						hStdErrReadTmp,
						GetCurrentProcess(),
						&hStdErr,
						NULL,
						FALSE,
						DUPLICATE_SAME_ACCESS))
	{
		error(L"Failed to duplicate stderr handle.");
		return FALSE;
	}

	// close inheritable pipes
	CloseHandle(hStdInWriteTmp);
	CloseHandle(hStdOutReadTmp);
	CloseHandle(hStdErrReadTmp);*/

	sa.nLength = sizeof(SECURITY_ATTRIBUTES);
	sa.bInheritHandle = TRUE;

	// try to create a new file first, if that doesnt't work open the existing one

	hStdIn = CreateFile(L"Input.txt",
						GENERIC_WRITE,
						FILE_SHARE_READ,
						&sa,
						CREATE_NEW,
						FILE_ATTRIBUTE_NORMAL, //FILE_FLAG_DELETE_ON_CLOSE,
						NULL);
	if(!hStdIn)
	{
		hStdIn = CreateFile(L"Input.txt",
							GENERIC_WRITE,
							FILE_SHARE_READ,
							&sa,
							TRUNCATE_EXISTING,
							FILE_ATTRIBUTE_NORMAL, …
death_oclock 103 Posting Whiz

You have to set the project as Windows GUI type and add the opengl libraries to the project. But thats alright, thanks for the effort at least.

death_oclock 103 Posting Whiz

You can click on the link that says "Toggle Plain Text" and just copy it from there. And the first WndProc is just a definition, because one of the other functions uses it before it is defined. Otherwise it would be a compiler error, and this compiles fine.

death_oclock 103 Posting Whiz

Alright:

#include	<windows.h>
#include	<gl/gl.h>
#include	<gl/glu.h>
#include	<gl/glext.h>

#define ELEMENTS(var) sizeof(var) / sizeof(var[0])

#define TITLE "RPG!"
#define WIDTH 1024
#define HEIGHT 768
#define BITS 16

HDC			hDC = NULL;
HGLRC		hRC = NULL;
HWND		hWnd = NULL;
HINSTANCE	hInstance;

bool		keys[256];
bool		active = TRUE;
bool		fullscreen = TRUE;

LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);

bool LoadBitmap(char *file, BITMAP *BMP, bool DIB = false)
{
	HBITMAP hBMP;
	
	hBMP = (HBITMAP)LoadImage(GetModuleHandle(NULL), file, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE);
	if(!hBMP)
	{
		return FALSE;
	}
	GetObject(hBMP, sizeof(BMP), BMP);
	
	if(DIB)
	{
		BITMAPINFOHEADER bmInfoHeader;
		bmInfoHeader.biSize = sizeof(bmInfoHeader);
		bmInfoHeader.biWidth = BMP->bmWidth;
		bmInfoHeader.biHeight = BMP->bmHeight;
		bmInfoHeader.biPlanes = 1;
		bmInfoHeader.biBitCount = 16;
		bmInfoHeader.biCompression = BI_RGB;
		bmInfoHeader.biSizeImage = 0;
		bmInfoHeader.biXPelsPerMeter = 0;
		bmInfoHeader.biYPelsPerMeter = 0;
		bmInfoHeader.biClrUsed = 0;
		bmInfoHeader.biClrImportant = 0;
		
		BITMAPINFO bmInfo;
		bmInfo.bmiHeader = bmInfoHeader;
		
		GetDIBits(hDC, hBMP, 0, BMP->bmHeight, &(BMP->bmBits), &bmInfo, DIB_RGB_COLORS);
	}
	
	DeleteObject(hBMP);
	
	return TRUE;
}

bool LoadTexture(char *textureFile, GLuint *texture)
{
	BITMAP BMP;
	
	glGenTextures(1, texture);
	
	if(!LoadBitmap(textureFile, &BMP))
	{
		return FALSE;
	}
	
	glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
	
	glBindTexture(GL_TEXTURE_2D, *texture);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	//glTexImage2D(GL_TEXTURE_2D, 0, 3, BMP.bmWidth, BMP.bmHeight, 0, GL_BGR_EXT, GL_UNSIGNED_BYTE, BMP.bmBits);
	gluBuild2DMipmaps(GL_TEXTURE_2D, 3, BMP.bmWidth, BMP.bmHeight, GL_BGR_EXT, GL_UNSIGNED_BYTE, BMP.bmBits);
		
	return TRUE;
}

void ResizeGLScene(GLsizei width, GLsizei height)
{
	if(height == 0)
	{
		height = 1;
	}
	
	glViewport(0, 0, width, height);
	
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	
	gluPerspective(45.0f, (GLfloat)width / (GLfloat)height, 0.1f, 100.0f);
	
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
}

bool InitGL()
{
	glEnable(GL_TEXTURE_2D);
	glShadeModel(GL_SMOOTH);
	glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
	glClearDepth(1.0f);
	glEnable(GL_DEPTH_TEST);
	glDepthFunc(GL_LEQUAL);
	
	return TRUE;
}

bool DrawGLScene()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glLoadIdentity();
	
	glTranslatef(0.0f, 0.0f, -5.0f);
	
	glColor3f(0.0f, 0.0f, 1.0f);
	glBegin(GL_QUADS);
		glVertex3f(0.0f, 1.0f, …
death_oclock 103 Posting Whiz

If I call the MessageBox function:

MessageBox(NULL, "Message", "Message", MB_OK);

for example, the box will not appear. It will make the beeping sound, though.

death_oclock 103 Posting Whiz

I am trying to write an openGL application from a tutorial I found and tried to copy it as accurately as possible without just copy+pasting it, so I can actually learn the code. The source file from the tutorial compiles and runs perfectly, but my code fails at a call of CreateWindowEx().
Here is just that code:

hWnd = CreateWindowEx(dwExStyle,
			lpszClassName,
			title,
			dwStyle | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
			0,
			0,
			WindowRect.right - WindowRect.left,			WindowRect.bottom - WindowRect.top,
			NULL,
			NULL,
			hInstance,
			NULL);
	
if(!hWnd)
{
	KillGLWindow();
	MessageBox(NULL, "Failed to create window.", "Error!", MB_ICONEXCLAMATION | MB_OK);
	return FALSE;
}

It always call the message box.

Here is the entire code:

#include <windows.h>
#include <GL/glu.h>
#include <GL/gl.h>

HDC hDC = NULL;
HGLRC hRC = NULL;
HWND hWnd = NULL;
HINSTANCE hInstance;
LPSTR lpszClassName = "WndClass";

bool keys[256];
bool active = true;
bool fullscreen = true;

LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);

GLvoid ResizeGLScene(GLsizei width, GLsizei height)
{
	if(height == 0)
	{
		height = 1;
	}
	
	glViewport(0, 0, width, height);
	
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	
	// Calculate aspect ratio
	gluPerspective(45.0f, (GLfloat)width / (GLfloat)height, 0.1f, 100.0f);
	
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
}

int InitGL()
{
	glShadeModel(GL_SMOOTH);
	
	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
	
	glClearDepth(1.0f);
	glEnable(GL_DEPTH_TEST);
	glDepthFunc(GL_LEQUAL);
	
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // 2nd arg: (GL_NICEST | GL_FASTEST)
	
	return TRUE;
}

int DrawGLScene()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glLoadIdentity();
	return TRUE;
}

GLvoid KillGLWindow()
{
	if(fullscreen)
	{
		ChangeDisplaySettings(NULL, 0);
		ShowCursor(true);
	}
	
	if(hRC)
	{
		if(!wglMakeCurrent(NULL, NULL))
		{
			MessageBox(NULL, "Failed to release DC and RC.", "Error!", MB_ICONEXCLAMATION | MB_OK);
		}
		
		if(!wglDeleteContext(hRC))
		{
			MessageBox(NULL, "Failed to delete …
death_oclock 103 Posting Whiz

Ugh! I've been programming c++ for at least a year and I make a n00b mistake like that. Oh well. Thank you so much, I wouldn't have caught that myself.

death_oclock 103 Posting Whiz

It doesn't report any errors in scene.h, but here is the code anyway:

#define RES_X 80
#define RES_Y 50

typedef class SCENE
{
	private:
		char heightMap[RES_X][RES_Y]; // white = highest, black = lowest;
		bool boundaryMask[RES_X][RES_Y]; // white = available; black = unavailable;
	
	public:
		bool loadHeightMap(char *filename)
		{
			FILE *image = fopen(filename, "rb");
			int pixel;
			bool end = false;
			
			for(int x = 0; x < RES_X; x++)
			{
				for(int y = 0; y < RES_Y; y++)
				{
					if(!end)
					{
						pixel = getc(image);
						
						if(pixel == EOF) end = true;
					}
					
					this->heightMap[x][y] = (end) ? 0 : pixel;
				}
			}
			
			fclose(image);
			
			if(end) return false;
			else return true;
		}
		
		bool loadBoundaryMask(char *filename)
		{
			FILE *image = fopen(filename, "rb");
			int pixel;
			bool end = false;
			
			for(int x = 0; x < RES_X; x++)
			{
				for(int y = 0; y < RES_Y; y++)
				{
					if(!end)
					{
						pixel = getc(image);
						
						if(pixel == EOF) end = true;
					}
					
					this->boundaryMask[x][y] = (end) ? 0 : (bool)pixel;
				}
			}
		}
		
		void draw()
		{
			for(int x = 0; x < RES_X; x++)
			{
				for(int y = 0; y < RES_Y; y++)
				{
					if(this->boundaryMask[x][y]) printf("1");
					else printf("0");
				}
			}
		}
}
death_oclock 103 Posting Whiz

So I have this code (the unnecessary parts omitted):

#include <stdio.h>
#include "scene.h"

int main() {
	while(1);
	
	return 0;
}

And another file in the project called "scene.h".

When I compile, I get these errors:

new types may not be defined in a return type
extraneous 'int' ignored
invalid function declaration

All are talking about line 4.
If I remove line 2, it compiles fine (only because I haven't used anything from this file yet).

Any ideas on how to fix this?