472,804 Members | 945 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Declaration Syntax error

Hello peoples
i am having trouble compiling this program getting a the error is "Declaration Syntax error" using borland c++ bulider v.6 if any one can help thanks

Expand|Select|Wrap|Line Numbers
  1. void __fastcall TFrame2::FrameClick(TObject *Sender)
  2. {
  3.  int main()
  4. {                                    //it is showing the error right here
  6.         ifstream myfile("c:\fileopen.txt");
  7.         if(myfile.is_open())
  8.         {
  9.                 while(!myfile.eof())
  10.                 {
  11.                         getline(myfile, line);
  12.                         cout<<line<<endl;
  13.                 }
  14.                 myfile.close();
  15.         }
  16.         else cout<<"Unable to open file"<<endl;
  18. }
  19.          return 0;
  20. }
Sep 21 '06 #1
3 17339
9,065 Expert Mod 8TB
You appear to be trying to declare main inside

void __fastcall TFrame2::FrameClick(TObject *Sender)

this is wrong your structure should be

Expand|Select|Wrap|Line Numbers
  1. void __fastcall TFrame2::FrameClick(TObject *Sender)
  2. {
  3. // Function code
  4. }
  6. int main(int argc, char **argp)
  7. {
  8. // Function code
  9. }
Sep 22 '06 #2
Hey Mandogon did you get it? I mean did you solve your problem?
I have also the same problem with a little difference.
I have set all of my functioons right but I have still the same error.
this is the programm.

int iszoj(long int a)
if (a%2!=0)
return (0);
return (1);
int isaval(long int b)

for(int i=2;i<b/2+1;i++){
for(int j=2;j<i;j++)
return (0);
return (1);
void main()
{ //I have the error here.
int a,b,second;
for(int i=a;i<=b;i++)
if (iszoj(i))
for(int j=1;j<I/2+1;j++)
second =i-j;
Dec 17 '07 #3
closing brace of for loop in isaval(long int b) is missing. check it carefully.
Dec 18 '07 #4

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

Similar topics

by: kellymart87 | last post by:
//remain.cpp #include <iostream.h> #include <conio.h> int main() getline ()
by: DanielTNBaker | last post by:
Basically gettting a "Declaration Syntax Error" do not understand what i have done wrong would appreciate it if someone could help. void Search_Client(void); void PriceList(void); void...
by: Lothsfeld | last post by:
Can someone help me w/ this I can't run it and I keep getting errors unable to open include file 'stdio.h' and declaration syntax error #include<stdio.h> main(); { int a,b,c; ...
by: Bowzer1999 | last post by:
I am a beginner at C++ and would be very grateful if someone could simply tell me why my program will not compile. My program is as follows, #include <stdio.h> #define int 1ST VALUE = 23.0 ...
by: networkmancer | last post by:
Written in Turbo C++ so dont tell me its very messy because I know it is and this is an assignment that we must stick in to. The source of the problem is in Case 5 int main { . I just dont know how...
by: Blondie1966 | last post by:
Im trying to write a program about a truck inventory with trucks coming and going and the amount in each one, but keep coming up with declaration syntax error.. Any help would be greatly appreciated....
by: dianaroslan | last post by:
There are three errors in coding during compile. one of them is the declaration syntax error. can help me to finish coding this? really need help from anyone who knows. i have some problem with my...
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
by: lllomh | last post by:
How does React native implement an English player?
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.