sys header files

hey i keep getting this error trying to compile my code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>

int main()
{
	int x;
	DIR *dhandel;
	struct dirent *drecord;

	dhandle = opendir("mods");
	puts("The halo trial mod switcher!");
	if(dhandle == NULL)
	{
		puts("error opening the mod folder. Check its called mods");
		return(1);
	}
	while( (drecord = readdir(dhandle)) != NULL)
		printf("%s\n",drecord->d_name);
}


this is my error message.

1>------ Build started: Project: ModSwitch, Configuration: Debug Win32 ------
1>Compiling...
1>scource code.cpp
1>c:\csp\cygwin\usr\local\pspdev\psp\include\sys\stdio.h(4) : fatal error C1083: Cannot open include file: 'sys/lock.h': No such file or directory
1>Build log was saved at "file://c:\Users\User\Documents\Visual Studio 2008\Projects\ModSwitch\ModSwitch\Debug\BuildLog.htm"
1>ModSwitch - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

does anyone know where i can download these files or whats causing this error?
Last edited on
You should use the namespace called std for standard functions:



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>

using namespace std;   //   <-

int main()
{
	int x;
	DIR *dhandel;
	struct dirent *drecord;

	dhandle = opendir("mods");
	puts("The halo trial mod switcher!");
	if(dhandle == NULL)
	{
		puts("error opening the mod folder. Check its called mods");
		return(1);
	}
	while( (drecord = readdir(dhandle)) != NULL)
		printf("%s\n",drecord->d_name);
}


after adding that line it should work if the problem was only that
Last edited on
using namespace std; didnt work but I found something in my c++ book about directories and it works. :) thx anyway tho
Topic archived. No new replies allowed.