fatal error-unexpected end of file while looking for precompiled header - Code :
-
// BUDDY SYSTEM CODE
-
-
#include<stdio.h>
-
#include<conio.h>
-
int tree[2050],i,j,k;
-
void
-
segmentalloc(int,int),makedivided(int),makefree(int),printing(int,int);
-
int place(int),power(int,int);
-
main()
-
{
-
int totsize,cho,req;
-
clrscr();
-
for(i=0;i<80;i++) printf("%c",5);
-
printf("
-
B U D D Y S Y S T E M R E Q U I R E M E N T
-
S
-
-
");
-
for(i=0;i<80;i++) printf("%c",5);
-
printf("
-
* Enter the Size of the memory : ");
-
scanf("%d",&totsize);
-
clrscr();
-
while(1)
-
{
-
for(i=0;i<80;i++) printf("%c",5);
-
printf("
-
B U D D Y S Y S T E M
-
-
");
-
for(i=0;i<80;i++) printf("%c",5);
-
printf("
-
-
* 1) Locate the process into the Memory
-
");
-
printf("
-
* 2) Remove the process from Memory
-
");
-
printf("
-
* 3) Tree structure for Memory allocation Map
-
");
-
printf("
-
* 4) Exit
-
-
-
");
-
for(i=0;i<80;i++) printf("%c",5);
-
printf("
-
-
* Enter your choice : ");
-
scanf("%d",&cho);
-
switch(cho)
-
{
-
case 1:
-
clrscr();
-
printf("
-
");
-
for(i=0;i<80;i++) printf("%c",5);
-
printf("
-
");
-
printf(" M E M O R Y A L L O C A T I O N
-
-
");
-
for(i=0;i<80;i++) printf("%c",5);
-
printf("
-
-
* Enter the Process size : ");
-
scanf("%d",&req);
-
segmentalloc(totsize,req);
-
break;
-
case 2:
-
clrscr();
-
printf("
-
");
-
for(i=0;i<80;i++) printf("%c",5);
-
printf("
-
");
-
printf(" M E M O R Y D E A L L O C A T I O N
-
-
");
-
for(i=0;i<80;i++) printf("%c",5);
-
printf("
-
-
* Enter the process size : ");
-
scanf("%d",&req);
-
makefree(req);
-
break;
-
case 3:
-
clrscr();
-
printf("
-
");
-
for(i=0;i<80;i++) printf("%c",5);
-
printf("
-
M E M O R Y A L L O C A T I O N M A
-
P
-
-
");
-
for(i=0;i<80;i++) printf("%c",5);
-
printf("
-
-
");
-
printing(totsize,0);
-
printf("
-
-
");
-
for(i=0;i<80;i++) printf("%c",5);
-
getch();
-
clrscr();
-
break;
-
default:
-
return;
-
}
-
}
-
}
-
-
void segmentalloc(int totsize,int request)
-
{
-
int flevel=0,size;
-
size=totsize;
-
if(request>totsize)
-
{
-
printf("
-
%c R E S U L T :
-
",2);
-
printf("
-
* The system don't have enough free memory
-
");
-
printf("
-
* Suggession : Go for VIRTUAL MEMORY
-
-
");
-
getch();
-
return;
-
}
-
while(1)
-
{
-
if(request<size && request>(size/2))
-
break;
-
else
-
{
-
size/=2;
-
flevel++;
-
}
-
}
-
for(i=power(2,flevel)-1;i<=(power(2,flevel+1)-2);i++)
-
if(tree[i]==0 && place(i))
-
{
-
tree[i]=request;
-
makedivided(i);
-
printf("
-
-
Result : Successful Allocation
-
-
");
-
break;
-
}
-
if(i==power(2,flevel+1)-1)
-
{
-
printf(" %c Result : ");
-
printf("
-
* The system don't have enough free memory
-
-
");
-
printf("
-
* Suggession : Go for VIRTUAL Memory Mode
-
-
");
-
}
-
}
-
-
void makedivided(int node)
-
{
-
while(node!=0)
-
{
-
node=node%2==0?(node-1)/2:node/2;
-
tree[node]=1;
-
}
-
}
-
-
int place(int node)
-
{
-
while(node!=0)
-
{
-
node=node%2==0?(node-1)/2:node/2;
-
if(tree[node]>1)
-
return 0;
-
}
-
return 1;
-
}
-
-
void makefree(int request)
-
{
-
int node=0;
-
while(1)
-
{
-
if(tree[node]==request)
-
break;
-
else
-
node++;
-
}
-
tree[node]=0;
-
while(node!=0)
-
{
-
if(tree[node%2==0?node-1:node+1]==0 && tree[node]==0)
-
{
-
tree[node%2==0?(node-1)/2:node/2]=0;
-
node=node%2==0?(node-1)/2:node/2;
-
}
-
else break;
-
}
-
}
-
-
int power(int x,int y)
-
{
-
int z,ans;
-
if(y==0) return 1;
-
ans=x;
-
for(z=1;z<y;z++)
-
ans*=x;
-
return ans;
-
}
-
-
void printing(int totsize,int node)
-
{
-
int permission=0,llimit,ulimit,tab;
-
if(node==0)
-
permission=1;
-
else if(node%2==0)
-
permission=tree[(node-1)/2]==1?1:0;
-
else
-
permission=tree[node/2]==1?1:0;
-
if(permission)
-
{
-
llimit=ulimit=tab=0;
-
while(1)
-
{
-
if(node>=llimit && node<=ulimit)
-
break;
-
else
-
{
-
tab++;
-
printf(" ");
-
llimit=ulimit+1;
-
ulimit=2*ulimit+2;
-
}
-
}
-
printf(" %d ",totsize/power(2,tab));
-
if(tree[node]>1)
-
printf("---> Allocated %d
-
",tree[node]);
-
else if(tree[node]==1)
-
printf("---> Divided
-
");
-
else printf("---> Free
-
");
-
printing(totsize,2*node+1);
-
printing(totsize,2*node+2);
-
}
-
}
1 2026
I have a feeling that you are using Microsoft Visual Studio.NET and have created a Windows project instead of a console application project. This is true if your code has a #include for stdafx.h.
A Windows project has settings for Windows programs. One of these is pre-compiled headers.
The easiest solution is to create a new project as a Win32 Console Application but before clicking Finish in the wizard, select Next and uncheck "Precompiled headers". Then click Finish.
You can also avoid those Windows-only files like stdafx.h by clicking Empty Project before clicking Finish.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Newsgroup - Ann |
last post by:
I have a library function like GetOptions( ..., struct net_arch_t netArch,
....) and put the declaration into a regular header file like getopt.h. But
this function declaration also needs the...
|
by: Michael |
last post by:
I have a data application in a2k that I need to create two fixed width
text files and then combine them to a single file The first file is
header information and the second is transaction data. ...
|
by: Andrew Ward |
last post by:
Hi All,
I was wondering if it is possible to use precompiled headers without having
to include a <stdafx.h> or whatever in every source file.
My problem is that I have a project that makes heavy...
|
by: Bruno van Dooren |
last post by:
Hi,
I am working on a dll that exports COM interfaces, and i am having some
troubles with the use of precompiled headers.
the project compiles always, but if i use /Yu (default: use precompiled...
|
by: Tommy Vercetti |
last post by:
I am working on a Managed C++ project and I get the following error:
TestThread.cpp(3) : error C2859: c:\projects\ProjectName\debug\vc70.pdb
is not the pdb file that was used when this...
|
by: Lloyd Dupont |
last post by:
I'm using VS.NET 2005 beta 2.
I have problem compiling project (it says: 'cannot find file StdAfx.h" which
is right in the middle of my project).
The 1st time I create a new project and it fixes...
|
by: CJM |
last post by:
I've copied (& modified) some code from MSDN which uses a Repeater control,
but I'm getting an error: Unexpected end of file looking for
</HeaderTemplate>
As far as I can see I've not made an...
|
by: pamela fluente |
last post by:
I have created and published a precompiled application.
If I replace an ASP file, e.g. Default.ASP, with a new copy, by
sending it via FTP, do I do something WRONG?
Do I spoil the precompiled...
|
by: ma740988 |
last post by:
Section 6.5 of Josuttis, C++ Templates states - and I paraphrase.
"Let's assume for the sake of argument that every file to be compiled
starts with the same N lines of code. We could compile...
|
by: dm3281 |
last post by:
Hello, I have a text report from a mainframe that I need to parse.
The report has about a 2580 byte header that contains binary information
(garbage for the most part); although there are a...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |