I'm sure I'm missing something basic here, but I cannot get this to compile. Using codeblocks 10.05 with mingw build of gcc 4.4.1. I've included unistd.h and tried replacing MAXPATHLEN with PATH_MAX but every time, it gives me:

error: 'MAXPATHLEN' was not declared in this scope

or

error: 'PATH_MAX' was not declared in this scope

#include <iostream>
#include <unistd.h>

int main()
{
    char temp[MAXPATHLEN];
    return 0;
}

I've also tried

#include "unistd.h"

to no avail.

Include <climits> for PATH_MAX,and MAXPATHLEN is in <sys/param.h>.

Thanks. Are they interchangeable?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.