Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

identifier not found

Status
Not open for further replies.

raileyb

Programmer
Apr 9, 2005
13
US
If you want to customize the installer for Windows Mobile applications, you have to create C++ code.

I wanted to rename a file before the uninstall of a a previous version started.

codeUNINSTALL_INIT Uninstall_Init(HWND hwndParent, LPCTSTR pszInstallDir)
{
int result;
char oldname[] ="oldname.txt";
char newname[] ="newname.txt";
result = rename( oldname , newname );
return codeUNINSTALL_INIT_CONTINUE;
}

I was looking to add a file rename call in the Uninstall_Init, just a tweek from your coding example.
But I try to compile it I get

error C3861: 'rename': identifier not found

The includes in the .cpp file are:
#include <windows.h>
#include "stdio.h"
#include "ce_setup.h"

I haven't done C++ in 10 years and I'm pretty lost, I've searched/googled all day with no luck. Can anyone help me?

thanks,
Brian
 
Not sure about mobile apps. rename should be part of stdio.h (incidentally this should be <stdio.h> not "stdio.h"). Try
Code:
::rename(oldname, newname);
 
Thanks,
I made the change to <stdio.h>

and tried ::rename (oldname, newname);

and now I get:
Error 25 error C2039: 'rename' : is not a member of '`global namespace''

now I see the rename defined in stdio.h, I don't understand why it's not being found.

Brian
 
<stdio.h> header does not contain any namespaces (it's C-compatible header). It's <cstdio> declares C-part of C++ RTL in a global namespace.
 
Thanks out to everyone for your attempts to help me.

Here is what I found, inside cstdio

#if !defined(_WIN32_WCE)
// These are not supported on CE
using ::freopen; using ::getc; using ::perror;
using ::putc;
using ::remove; using ::rename; using ::rewind;
using ::setbuf; using ::tmpfile; using ::tmpnam;
#endif

It appears, if I'm reading this right, that rename is not supported on the platform I've targeted.

I did solve my problem by using CopyFile

Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top