Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > structs

Reply
Thread Tools

structs

 
 
Harry Overs
Guest
Posts: n/a
 
      08-23-2004
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,


 
Reply With Quote
 
 
 
 
Harry Overs
Guest
Posts: n/a
 
      08-23-2004
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" <(E-Mail Removed)> wrote in message
news:cgcamh$tr9$(E-Mail Removed)...
> 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,
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Packed structs vs. unpacked structs: what's the difference? Daniel Rudy C Programming 15 04-10-2006 08:10 AM
Array of structs instead of an array with pointers to structs? Paminu C Programming 5 10-11-2005 07:18 PM
length of an array in a struct in an array of structs in a struct in an array of structs Tuan Bui Perl Misc 14 07-29-2005 02:39 PM
const structs in other structs Chris Hauxwell C Programming 6 04-27-2004 07:03 PM
structs with fields that are structs Patricia Van Hise C Programming 5 04-05-2004 01:37 AM



Advertisments