473,386 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

visual studio 2010 erroes C2601 and C1075

i have some problems with this code i keep getting the error C2601: local function definitions are illegal.what i do wrong??

Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3.  
  4. int col;
  5. int row; 
  6. int i;
  7. int count;
  8. char Area[99][99];
  9.  
  10.  
  11. int main()
  12. {
  13.     void SetField()
  14.     {
  15.       do 
  16.        {
  17.          printf("enter colmn");
  18.          scanf("%d",&col);
  19.          printf("enter row");
  20.          scanf("%d",&row);
  21.          printf("to exit enter colmn and row -999");
  22.         }
  23.       while((col!=-999)&&(row!=-999));
  24.  
  25.     }
  26.  
  27.     void KillNieghbors(int g,int c)
  28.       {
  29.         for(i=0;i<100;i++)
  30.             for(j=0;j<100;j++)
  31.             { 
  32.                 count=0;
  33.                 while(int count<4)
  34.                  {
  35.                      count++;
  36.                  }
  37.  
  38.               if(count<3)
  39.                  { 
  40.                      Killneighbor(i,j);
  41.                  }
  42.             }
  43.  
  44.             void PrintField()
  45.              {
  46.                  for(i=0;i<100;i++)
  47.                      for(j=0;j<100;j++)
  48.                  {
  49.                      printf("c%",&Aria[i][j]);
  50.  
  51.                  }
  52.  
  53.              }
  54.  
  55.        }
  56. }
  57.  
  58.  


Error error C1075: end of file found before the left brace '{' at ...69

Error 1 error C2601: 'SetField' : local function definitions are illegal 17

Error 2 error C2601: 'KillNieghbors' : local function definitions are illegal 31
May 10 '12 #1
3 2913
weaknessforcats
9,208 Expert Mod 8TB
You can't do this:
Expand|Select|Wrap|Line Numbers
  1. int main()
  2.  12. {
  3.  13.     void SetField()
  4.  14.     {
  5.  15.       do 
  6.  16.        {
  7.  17.          printf("enter colmn");
  8.  18.          scanf("%d",&col);
  9.  19.          printf("enter row");
  10.  20.          scanf("%d",&row);
  11.  21.          printf("to exit enter colmn and row -999");
  12.  22.         }
  13.  23.       while((col!=-999)&&(row!=-999));
  14.  24. 
  15.  25.     }
  16. etc...
  17.  
Functions must be defined outside of any other function.

This has been done in other places in our code.
May 10 '12 #2
tank you'but i dont understand what the problem is

here:
Expand|Select|Wrap|Line Numbers
  1. void SetField()
  2.     {//this is underlined in red
  3.       do 
  4.        {
  5.          printf("enter colmn");
  6.          scanf("%d",&col);
  7.          printf("enter row");
  8.          scanf("%d",&row);
  9.          printf("to exit enter colmn and row -999");
  10.         }
  11.       while((col!=-999)&&(row!=-999));
  12.  
  13.     }
there is not a declaretion of another function in this func.
now it givs me :IntelliSense: expected a ';' 17
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. #include<stdio.h>
  4. #include<stdlib.h>
  5.  
  6. int Width=99;
  7. int Height=99;
  8. int col;
  9. int row; 
  10. int i;
  11. int count;
  12. char Area[99][99];
  13.  
  14.  
  15.  
  16. int main()
  17. {
  18.     void SetField()
  19.     {//problem is in this line
  20.       do 
  21.        {
  22.          printf("enter colmn");
  23.          scanf("%d",&col);
  24.          printf("enter row");
  25.          scanf("%d",&row);
  26.          printf("to exit enter colmn and row -999");
  27.         }
  28.       while((col!=-999)&&(row!=-999));
  29.  
  30.     }
  31.  
  32.     void KillNieghbors(int row,int col)
  33.       {
  34.         for(i=0;i<100;i++)
  35.             for(j=0;j<100;j++)
  36.             { 
  37.                 count=0;
  38.                 while(count<4)
  39.                  {
  40.                      count++;
  41.                  }
  42.  
  43.               if(count<3)
  44.                  { 
  45.                      KillNieghbors(int g,int c);
  46.                  }
  47.             }
  48.     }
  49.             void PrintField()
  50.              {
  51.                  for(i=0;i<100;i++)
  52.                      for(j=0;j<100;j++)
  53.                  {
  54.                      printf("c%",&Aria[i][j]);
  55.  
  56.                  }
  57.  
  58.              }
  59.  
  60.        }
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
May 11 '12 #3
weaknessforcats
9,208 Expert Mod 8TB
If SetFisld is a function then you call it main() this way:

Expand|Select|Wrap|Line Numbers
  1. int main()
  2. {
  3.     SetField();
  4. }
The code for this function:
Expand|Select|Wrap|Line Numbers
  1. void SetField()
  2.       {
  3.        do 
  4.         {
  5.           printf("enter colmn");
  6.           scanf("%d",&col);
  7.           printf("enter row");
  8.           scanf("%d",&row);
  9.           printf("to exit enter colmn and row -999");
  10.          }
  11.        while((col!=-999)&&(row!=-999));
  12.  
  13.      }
  14.  
cannot be inside main() or any other function.
May 11 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: jabailo | last post by:
These guys have it going on. They actually use design ideas that Microsoft employees can drool upon. Visual Studio 2010 Concept IDE http://www.codeproject.com/csharp/Concept_IDE.asp "Like...
1
by: =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?= | last post by:
Visual Studio 2010 and .NET Framework 4.0 Overview URL:http://msdn.microsoft.com/en-us/vstudio/products/cc948977.aspx Regards Kerem -- ----------------------- Beste Grüsse / Best regards...
0
by: mgarg005SSRS | last post by:
My requirement is to create multiple reports (.rdlc) and show them using single report viewer control. A: User selects a report from drop down list. B: Depending on report name a report has to be...
0
by: garbmail10 | last post by:
Hallo to all I'm using visual studio 2010 c# on windows 7 In a program i use SpeechLib (located in C:\Windows\System32\Speech\Common\sapi.dll) with SpVoice voice = new SpVoice();...
0
by: Jourdan | last post by:
I am creating a web application backed by a SQL database in visual studio 2010. I have created a form with a dropdownlists for date and category as well as a textbox to perform a key word search. The...
0
OuTCasT
by: OuTCasT | last post by:
Hi I have recently ugraded to VS2010 and downloaded Crystal Reports for VS2010. Now when i build setup application and install on client pc i get errors that the Crystal Report cannot be loaded and...
2
by: Sergio Youda | last post by:
This is the output of the software after that I try to compile it 1>Helper.obj : error LNK2019: riferimento al simbolo esterno _GdiplusStartup@12 non risolto nella funzione "public: __thiscall...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.