error C2143: missing ';' when i shouldn't have one

Hi, been lurking for a while and had an issue so i thought i might make my first post. I would gauge myself between a beginner and intermediate but this i feel is def a beginner issue.

I'm saving certain settings and profiles into custom files into a directory. This code is purely to get a list of those files. (easy enough). I've written it in a test app and it worked beautifully. So I copied the function across to my main app and now it will not compile. It's in its own file at the moment, only difference to the the test app is that it's not console and theres no int main().

Here's the entire source file, general.h defines a simple struct with a string + a pointer for a linked list (other source files in the same solution compile nicely with it) :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <windows.h>
#include <string>

#include "general.h"

using std::string;



fileInfo* buildFileList(char* path)
{
WIN32_FIND_DATA	FindFileData;
LPSTR			DirSpec = NULL;
HANDLE			hFind = INVALID_HANDLE_VALUE;
DWORD			dwError;
fileInfo*		firstFile;
fileInfo*		currentFile;

	hFind = FindFirstFile(path, &FindFileData);
	if (hFind == INVALID_HANDLE_VALUE) 
      return NULL;


	firstFile = new fileInfo;
	currentFile = firstFile;
	currentFile->filePath = FindFileData.cFileName;


	while(FindNextFile(hFind, &FindFileData) != 0)
	{
		currentFile->nextFile = new fileInfo;
		currentFile = currentFile->nextFile;
		currentFile->filePath = FindFileData.cFileName;
		currentFile->nextFile = NULL;
	}
	

	dwError = GetLastError();
	FindClose(hFind);
	if (dwError != ERROR_NO_MORE_FILES) 
	{
		currentFile = firstFile;
		while(firstFile != NULL)
		{
			firstFile = currentFile->nextFile;
			delete currentFile;
		}

		return NULL;
	}
	return firstFile;
}


and the error message?
\filehandling.cpp(15) : error C2143: syntax error : missing ';' before '*'

then over 100 of this type:
\filehandling.cpp(35) : error C2143: syntax error : missing ';' before '{'


I'm at my wits end as to where that semi-colon is meant to be. Any help would be much appreciated
Last edited on
Just at a glance I would suggest you take a look at your "general.h" file and check to make sure you didn't forget a semi-colon there.
There was indeed a problem with general.h. Just on a whim instead of loading it from the filelist pane thingo i right clicked on the #include and opened it that way and it opened a completely different file in a different project. After removing it and readding it, everything runs nicely. Cheers.
Topic archived. No new replies allowed.