Thread: Problem with _mangled_main. kinda urgent :\

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    5

    Problem with _mangled_main. kinda urgent :\

    Hi there.

    I'm with a problem. I'm programming an allegro simulation and I have made a typedef struct bola_st and g is a pointer to this struct.

    Code:
     
        typedef struct bola_st{
            float x,y,z,t;
            bola_st *next;
            } bola_st;
    
        bola_st *g=malloc(sizeof(bola_st)*bolasps*sqrt(h/4.9));

    and when I'm compiling the following error message appears:

    cannot convert `_mangled_main(int, char**)::bola_st*' to `bola_st*' for argument `1' to `double calculo(bola_st*, float, float, int, float)'

    in this line

    Code:
     calculo(g,TEMPO_TOTAL,b,h,bolasps);
    (calculo is a function)

    I don't know why this is appearing...I would be pretty thankful if anyone help me

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    take the typedef out of main
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #3
    Registered User
    Join Date
    Jan 2007
    Posts
    5
    I've made the typedef in and out of the main :\

  4. #4
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Quote Originally Posted by LacerdaPT
    I've made the typedef in and out of the main :\
    in this case you should post more code

    try to post the sample that can be compiled and represents the error
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  5. #5
    Registered User
    Join Date
    Jan 2007
    Posts
    5
    the same problem appears when I call the function "desenhar" that requires the pointer g too

    the header of the .c file is this
    Code:
    typedef struct bola_st{
            float x,y,z,t;
            struct bola *next;
            } bola_st;
    
    double calculo(struct bola_st *, float, float ,int, float);
    void desenhar(struct bola_st*, float ,BITMAP *, BITMAP *, BITMAP *, float );
    and here I call the functions..

    Code:
    while(var_tempo>0){
             calculo(g,TEMPO_TOTAL,b,h,bolasps); var_tempo--;
             }
             desenhar(g, h, pistola_lado, bola, bola_preta, bolasps);
        }
    and then I start defining the functions

    Code:
    double calculo(struct bola_st *g, float TEMPO_TOTAL, float h, int b, float bolasps){
    (...)
    void desenhar(struct bola_st *g, float h, BITMAP *pistola_lado, BITMAP *bola, BITMAP *bola_preta, float bolasps){
    (...)

  6. #6
    The larch
    Join Date
    May 2006
    Posts
    3,573
    bola_st *g=malloc(sizeof(bola_st)*bolasps*sqrt(h/4.9));

    What is this meant to do? You are using floats to allocate memory?

  7. #7
    Registered User
    Join Date
    Jan 2007
    Posts
    5
    I'm defining the size of the memory to allocate, so I used the function sizeof() and do it n times..this n is a float

  8. #8
    Registered User
    Join Date
    Jan 2007
    Posts
    5
    actually it is not lol I missed that... I typecasted it now thanks lol

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. searching problem
    By DaMenge in forum C Programming
    Replies: 9
    Last Post: 09-12-2005, 01:04 AM
  2. string comparision : Urgent problem
    By karanmitra in forum C Programming
    Replies: 17
    Last Post: 08-08-2005, 05:38 PM
  3. Bin packing problem....
    By 81N4RY_DR460N in forum C++ Programming
    Replies: 0
    Last Post: 08-01-2005, 05:20 AM
  4. Words and lines count problem
    By emo in forum C Programming
    Replies: 1
    Last Post: 07-12-2005, 03:36 PM
  5. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 08:37 AM