structs

Discussion in 'C++' started by Harry Overs, Aug 23, 2004.

  1. Harry Overs

    Harry Overs Guest

    I've just been given some code which is written in a C way (i.e. no classes)
    and which acts as an interface for a program written in Ada.
    Our aim is to modify the C/C++ code so that the interface sends an receives
    data over a socket connection. I implmented all of the socket side with no
    problem and have created a struct which will be passed in and out of the
    program. The problem that I have is that when I build this interface by
    itself in Visual Studio 6 it compiles fine with no errors, however when I
    try and compile it on the command line (still using the studio compiler, I
    am compiling this on the command line as I have to use gnat to compile the
    Ada code and then to link all of these object files together to create my
    executable), I get errors where the struct is used, i.e.

    struct myStruct
    {
    int a ;
    int b ;
    }

    void myProc ( myStruct *stru ) ; -- error on this line


    does anyone have any idea why this wont work on the command line but will in
    the studio environment?

    (also there may be one or two errors in the above code as the code is on a
    different machine, also I have though about just compiling it in studio and
    then copying the object files, but this seems to me to be a bodge instead of
    a proper fix)

    cheers,
    Harry Overs, Aug 23, 2004
    #1
    1. Advertising

  2. Harry Overs

    Harry Overs Guest

    just figured it out, in my studio project I've got the extension .cpp on my
    source files whereas on the file I compile on the command line I've got .c


    "Harry Overs" <> wrote in message
    news:cgcamh$tr9$...
    > I've just been given some code which is written in a C way (i.e. no

    classes)
    > and which acts as an interface for a program written in Ada.
    > Our aim is to modify the C/C++ code so that the interface sends an

    receives
    > data over a socket connection. I implmented all of the socket side with

    no
    > problem and have created a struct which will be passed in and out of the
    > program. The problem that I have is that when I build this interface by
    > itself in Visual Studio 6 it compiles fine with no errors, however when I
    > try and compile it on the command line (still using the studio compiler, I
    > am compiling this on the command line as I have to use gnat to compile the
    > Ada code and then to link all of these object files together to create my
    > executable), I get errors where the struct is used, i.e.
    >
    > struct myStruct
    > {
    > int a ;
    > int b ;
    > }
    >
    > void myProc ( myStruct *stru ) ; -- error on this line
    >
    >
    > does anyone have any idea why this wont work on the command line but will

    in
    > the studio environment?
    >
    > (also there may be one or two errors in the above code as the code is on a
    > different machine, also I have though about just compiling it in studio

    and
    > then copying the object files, but this seems to me to be a bodge instead

    of
    > a proper fix)
    >
    > cheers,
    >
    >
    Harry Overs, Aug 23, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Patricia  Van Hise

    structs with fields that are structs

    Patricia Van Hise, Apr 5, 2004, in forum: C Programming
    Replies:
    5
    Views:
    621
    Al Bowers
    Apr 5, 2004
  2. Chris Hauxwell

    const structs in other structs

    Chris Hauxwell, Apr 23, 2004, in forum: C Programming
    Replies:
    6
    Views:
    548
    Chris Hauxwell
    Apr 27, 2004
  3. Paminu
    Replies:
    5
    Views:
    630
    Eric Sosman
    Oct 11, 2005
  4. Daniel Rudy
    Replies:
    15
    Views:
    1,373
    Keith Thompson
    Apr 10, 2006
  5. Tuan  Bui
    Replies:
    14
    Views:
    462
    it_says_BALLS_on_your forehead
    Jul 29, 2005
Loading...

Share This Page