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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have problem with the string precompiller

Status
Not open for further replies.

omaduro

Technical User
May 29, 2002
3
AW
When I run the program in Borland c++ it runs ok. However, if I had to
build an executable for the same program, then it doesn't run, as it
should be.
The warning that I get when run the program is as follows:
"string.cc (658,22) : Cannot create pre-compiled header: code in
header"
I am using strings and I have defined #include<string>

I have disable the pre-compiled header in the settings, the warning did
disappear but whenever you run the program outside borland environment it
will not go through all the lines in the program. However if you run the
same program in borland environment it will run perfectly.

Here is a piece of the code,
Thank you,

Oldrin.

#include <iostream.h>
#include <string>
#include <windows.h>
#include <stdio.h>


void task_one ( string A1[], int &k);
void task_two (string B1[], int &z);
void task_admin (const char *admin);
void task_write (string C1[], int a);


int main()

{
cout << &quot;**************** Mail server update program
***************\n&quot;<<endl;
int cchoice;
const char *chk_key=&quot;\\Software\\Microsoft\\Internet Account
Manager\\Accounts\\&quot; ;
const char *test_key= &quot;\\Identities\\&quot;;
char cad1;
const char *admin;
string A1[20];
string B1[20];
int k=0;;
int j=0;
int wait;
int z;
int a;
string C1[20];

cout << &quot;1. If you are using Main Identity in your Outlook express of this
computer choose 1\n&quot; <<endl;
cout << &quot;2. If you are using switching Identity in your Outlook express
choose 2\n&quot; << endl;
cin>>cchoice;

switch (cchoice)
{
case 0:
cout << &quot;You have made a wrong choice \n&quot;;
break;

case 1:
cout << &quot;Your choice is &quot;<< cchoice<<endl;
task_one(A1, k);
for ( j=1; j <= k; j++)
{
string cad2 ;
cad2 = A1[j];
const char *cad1 = cad2.c_str();
//cout << cad1 <<endl;
admin = cad1 ;
//cout << admin;
task_admin (admin);
}
break;


case 2:
cout << &quot;Your choice is &quot;<<cchoice<<endl;
task_two(B1, z);
for ( j=1; j <= z; j++)
{

C1[j] = B1[j];

}
a = z ;
task_write (C1, a);


break;

default : cout << &quot;You have made a choice out of range\n&quot;;
break;
}

cout << &quot;Wait&quot;<<endl;
cin >> wait;
return 0;
}



void task_one (string A1[], int &k )

{
const char *chk_key=&quot;\\Software\\Microsoft\\Internet Account
Manager\\Accounts\\&quot; ;
const char *test_key= &quot;\\Identities\\&quot;;
char lszValue[100];
string S1[20];
string A2[20];
string task[20];
LONG lRet, lEnumRet;
char szKey[1024];
HKEY hKey;
DWORD dwLength=100;
int i=0;
int wait;
int j=0;

strcpy(szKey, chk_key);
lRet = RegOpenKeyEx (HKEY_CURRENT_USER, chk_key , 0L, KEY_READ , &hKey);
//open key to see how many accounts
if(lRet == ERROR_SUCCESS)
//are configured
{
lEnumRet = RegEnumKey (hKey, i,lszValue,dwLength);
while(lEnumRet == ERROR_SUCCESS)
{
i++;
//printf (&quot;%s\n&quot;,lszValue);
S1 = lszValue;
lEnumRet = RegEnumKey (hKey, i,lszValue,dwLength);
}
}

for ( j=1; j <= i; j++)
{
A1[j] = chk_key+S1[j];
// printf (&quot;%s\n&quot;,A1[j]);
}

k=i;

cout << &quot;Task one succesfully executed \n&quot;;
return;
}



 
I think that the erros is not in the code

Check that all files for the compiler are not &quot;read only&quot;




---LastCyborg---
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top