CFileUtils usage


#1

Hello, I’ve configured sample project, it builds and runs fine. Now I want to use some files functionality:

#include “cocos2d.h”
#include “platform/CCFileUtils.h”
>
void Foo()
{
CCFileUtils()::sharedFileUtils()->fullPathFromRelativeFile(" … ");
}

error: ‘CFileUtils’ was not declared in this scope

And IDE (eclipse) opens that file without troubles (so it opens and is visible for compiler), but why doesn’t it see the class declaration)?


#2

Maybe, because the namespace information is missing?
What about this…

#include "cocos2d.h" 
#include "platform/CCFileUtils.h"

USING_NS_CC;

void Foo() {
    CCFileUtils::sharedFileUtils()->fullPathFromRelativeFile(" ... ");
}

/miro/


#3

Yeah, it was stupid :slight_smile: Also, CCFileUtils() should be without braces, error otherwise due to abstract class. Thank you.