473,406 Members | 2,698 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,406 software developers and data experts.

type mismatch in redeclaration of rect

KUMARACC.C
----------

Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. #include<dos.h>
  3. #include<conio.h>
  4. #include "d:\kumaracc\button.c"
  5. #include "d:\kumaracc\hvline.c"
  6. #include "d:\kumaracc\label.c"
  7. #include "d:\kumaracc\rect.c"
  8. #include "d:\kumaracc\rmbutton.c"
  9. #include "d:\kumaracc\textbox.c"
  10.  
  11. # define ALT_A 7680
  12. # define ALT_L 9728
  13. # define ALT_X 11520
  14. void main(){
  15.     int key,c;
  16.     do{
  17.         clrscr();
  18.         printf("Enter choice\n");
  19.         printf("\n1. hvline\n2. label\n3. rect\n4. rmbutton\n5. textbox\n7. button\n6. Exit\n");
  20.         scanf("%d",&c);
  21.         switch(c){
  22.             case 1 :     hline(10,10,20,'*');
  23.                          vline(10,12,22,'*');
  24.                          getch();
  25.                          break;
  26.             case 2 : label(10,10,3,4,"DBList");
  27.                      getch();
  28.                          break;
  29.             case 3 : rect(10,10,30,12,'*','|');
  30.                         getch();
  31.                         break;
  32.             case 4 : rmbutton(10,10);
  33.                         getch();
  34.                         break;
  35.             case 5 : textbox(10,10,30);
  36.                         getch();
  37.                         break;
  38.             case 7 : button(10,10,"Open");
  39.                      getch();
  40.                      break;
  41.             case 6 : exit(0);
  42.         }
  43.     }while(1);
  44. }
  45.  
  46.  
  47.                           HVLINE.C
  48.                           --------
  49.  
  50. //    LS = LineSymbol
  51. int i;
  52. void hline(int x,int y,int x1,char LS){
  53.     for(i=x;i<=x1;i++){
  54.         gotoxy(i,y);
  55.         printf("%c",LS);
  56.     }
  57. }
  58. void vline(int x,int y,int y1,char LS){
  59.     for(i=y;i<=y1;i++){
  60.         gotoxy(x,i);
  61.         printf("%c",LS);
  62.     }
  63. }
  64.  
  65.  
  66.                        RECT.C
  67.                        ------
  68.  
  69. //    LS = Line Symbol
  70. void rect(int x,int y,int x1,int y1,char LS,char LS1){
  71.     hline(x,y,x1,LS);
  72.     hline(x,y1,x1,LS);
  73.     vline(x,y+1,y1-1,LS1);
  74.     vline(x1,y+1,y1-1,LS1);
  75. }
  76.  
  77.                         BUTTON.C
  78.                         --------
  79.  
  80. //CL = Character Length
  81. void button(int x,int y,char *Caption){
  82.     int CL;
  83.     CL=strlen(Caption);
  84.     rect(x,y-1,x+CL+3,y+1,'*','*');
  85.     gotoxy(x+2,y);
  86.     printf("%s",Caption);
  87. }
  88.  
  89.  
  90.                       TEXTBOX.C
  91.                       ---------
  92.  
  93. //    ML = Maximum Length
  94. void textbox(int x,int y,int ML){
  95.     rect(x,y,x+ML+1,y+2,'-','|');
  96. }
  97.  
  98.                       RMBUTTON.C
  99.                       ----------
  100.  
  101. //    rmbutton = Record Move Button
  102. void rmbutton(int x,int y){
  103.     int i;
  104.     rect(x,y-1,x+16,y+1,'þ','þ');
  105.     for(i=x+4;i<=x+12;i=i+4){
  106.         gotoxy(i,y);
  107.         printf("þ");
  108.     }
  109.     gotoxy(x+2,y);
  110.     printf("F");
  111.     gotoxy(x+6,y);
  112.     printf("P");
  113.     gotoxy(x+10,y);
  114.     printf("N");
  115.     gotoxy(x+14,y);
  116.     printf("L");
  117. }
Oct 3 '13 #1
2 2361
weaknessforcats
9,208 Expert Mod 8TB
I don't get the error about a type mismatch for a redeclaration of rect in the code you posted.

However, this is not correct:

Expand|Select|Wrap|Line Numbers
  1. #include "d:\kumaracc\button.c"
  2. #include "d:\kumaracc\hvline.c"
  3. #include "d:\kumaracc\label.c"
  4. #include "d:\kumaracc\rect.c"
  5. #include "d:\kumaracc\rmbutton.c"
  6. #include "d:\kumaracc\textbox.c"
  7.  
You do not include source code files in a source code file. This is the same as inserting a copy of the file itself. So if file A.c includes B.c and C.c and B.c also includes C.c you get redefinition errors because there are two copies of C.c and the code will never compile.

Instead you use a project to contain the source files and you use header files to declare functions leaving the linker the job of combining all the object files into your .exe.

You might want to read up on the C/C++ build process.
Oct 3 '13 #2
donbock
2,426 Expert 2GB
Do any of those other c files also include rect.c?

By the way, main() should return an int. You should not define it as returning void.
Oct 3 '13 #3

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

Similar topics

5
by: Arun Wadhawan | last post by:
Hello MY SQL Server is causing me this problem : Microsoft VBScript runtime error '800a000d' Type mismatch: 'ident' >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> I am getting from...
1
by: LJgrnl | last post by:
I've got a type mismatch error that's driving me nutty. Variable blnNoData has the initial value False. If a recordset comes back empty (both .EOF and ..BOF are true) then blnNoData is set to...
1
by: Mark | last post by:
Hi - I tried this in VS.Net, and also in the Web Matrix code below: - but I am getting a type mismatch error. The sql statement runs perfectly from within the Access Query Designer. Can anyone...
7
by: middletree | last post by:
I've been messing with this for hours, and have been to various sites, including Aaron's site, and am truly stumped. The short version: in SQL Server, the 4 fields in question are datetime. I...
4
by: Mike | last post by:
I am getting a type mismatch error when I do a bulk insert. ---Begin Error Msg--- Server: Msg 4864, Level 16, State 1, Line 1 Bulk insert data conversion error (type mismatch) for row 1, column...
6
by: shan | last post by:
What is the meaning for the error expression syntax and type mismatch error.I am using turbo c++.can anybody correct the errors in the folowing program. Following program is to find matrix...
1
by: Brett | last post by:
I have a form that calls a method within a DLL. By clicking a button on the form, the DLL is instantiated and the SaveOutlookMessage() method invoked. The DLL code copies messages from Outlook to...
6
by: Howard Kaikow | last post by:
I'm doing a VB 6 project in which I am trying to protect against type mismatch errors. Is the process any different in VB .NET? Here's what I'm doing in VB 6. I have an ActiveX DLL. The...
19
by: Lysander | last post by:
I have written a query that takes three integers representing day,month and year, forms a date from them and compares this date to the date the record was entered and returns any records where the...
1
by: crookward | last post by:
I usually have no problem identifying a type mismatch error, but this one's got me pulling my hair out. The mismatch error is pointing to line 269, which is a blank line, and it's also within an if...
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
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.