Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   how can i debug this? (http://www.go4expert.com/forums/i-debug-t27107/)

atoivan 8Nov2011 01:16

how can i debug this?
any time i run the codes i get these error messages.

HTML Code:

/tmp/ccffCVmG.o: In function `main': work.c:(.text+0x1e1): undefined reference to `create_new_stock' work.c:(.text+0x1e8): undefined reference to `display_stock' work.c:(.text+0x1ef): undefined reference to `sales' work.c:(.text+0x1f6): undefined reference to `modify' collect2: ld returned 1 exit status[/code]i do not know how to debug this.
help me debug this.

this is my codes
HTML Code:

#include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h>  void create_new_stock(void); void display_stock(void); void sales(void); void modify(void); void Additem(void); void Viewitems(void); void Viewcategory(void);  void Editcategory(void); void Edititems(void); void Edit(void); void Deleteitem(void); void Deletecategory(void); void PrintBeeper(void); void CreateFile(void); void DeleteFile(void);    double    u_prx = 0.0;            // unit price per item double    total=0.0;                // total sold per item double    G_total=0.0;            // grand total per day double    amut_b=0.0;            // buying price (bulk) double    amut_u=0.0;                //    buying price per item(unit) double    S_prx_Blk=0.0;            //    selling price in bulk double    S_prx_u=0.0;            //    selling price in unit double    T_amut_blk=0.0;            //  total amount in cash (bluk) double    T_amut_u =0.0;            //    total amount in cash (unit) double  qty_sold = 0.0;            // quantity sold per item int    T_qty_bulk =0;            //  quantity of items in bulk int    T_qty_u =0;                //  quantity of items in unit int    G_T_qty_bulk=0;            //grand total in bluk int        G_T_qty_u=0;            //grand total in unit int          qty_u= 0;                // quntity in bottle per item int        qty_left = 0;            // quntity left per item int        qty_bulk = 0;            // quantity in warehouse  char cate[20];                    // categories of items char iname[20];                // item name char code[6];                    // item code  int main() { char sele; // seletion of data system("cls"); puts(" Welcome to my sales Program"); puts("<1> \t Create a new stock "); puts("<2> \t Display Stock"); puts("<3> \t Sales"); puts("<4> \t Modify"); puts("<5> \t exit");  puts("Enter selection"); scanf("%c",&sele);                      switch (sele) { case '1': create_new_stock(); break; case '2': display_stock(); break; case '3': sales(); break; case '4': modify(); break; case '5': exit(1); break;      }  void create_new_stock() {    int bra=0; printf("Enter Category "); scanf("%s",cate); printf("How many brands do u want to add?"); scanf("%d",&bra); for(;;) { printf("Enter brand name"); scanf("%s",iname); printf("Enter Buying price(bulk)"); scanf("%lf",&amut_b); puts("Enter Quantity in bulk"); scanf("%d",&qty_bulk); puts("Enter Quantity of items (number of items in a box)"); scanf("%d",&qty_u); T_qty_u=qty_bulk*qty_u; T_amut_blk=amut_b/qty_u; puts("Enter Selling price for(box)"); scanf("%lf",&S_prx_Blk); puts("Enter selling price for unit"); scanf("%lf",&S_prx_u);  } }      void display_stock() {      }  void sales() {          }  void modify() {        } }
is there something i am missing here

somannitin 8Nov2011 13:15

Re: how can i debug this?
i am surprised it got to the linker??
remove the bracket after void modify() {} -> } and put a bracket after switch case.
this will end the main and the linker will find the functions it is complaining for

Trinity 24Nov2011 15:39

Re: how can i debug this?

Can you please re-paste your code snippet in the correct format? Its really difficult even reading your code to understand what you want to do.


All times are GMT +5.5. The time now is 14:24.