Thread: ODL file problem

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    32

    ODL file problem

    I'm exporting two UDTs from VC++ to VB6 using an ODL file.
    Da problem is that apparently I can't export a struct with members of another exported struct. Here's da code:

    Code:
    [uuid(1CFE9260-D6FB-11d7-9236-E4FCAE870F25),helpstring("Temp"),lcid(0x0409),version(1.0)]library Temp
    {
    [helpstring("Typesmodule"),version(1.0),dllname("Temp.dll")]module Typesmodule
    {struct point2d{double x,y;};
    struct line2d{point2d m1,m2};}
    };
    I'm getting error MIDL2025 : syntax error : expecting a type specification near "point2d"
    Is there something I can do about it?
    Last edited by Helix; 08-25-2003 at 02:52 PM.

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    >struct line2d{point2d m1,m2};}

    You are missing a semicolon here:
    struct line2d{point2d m1,m2;};}

    I doubt this will fix the error though. This is a wild guess. Is it possible this should be C, not C++?
    Code:
    struct line2d{struct point2d m1,m2;};}

  3. #3
    Registered User
    Join Date
    Jul 2003
    Posts
    32
    You are missing a semicolon here:
    struct line2d{point2d m1,m2;};}
    That was good to know, but it doesn't solve the problem.
    Reposting code ...
    Code:
    [uuid(1CFE9260-D6FB-11d7-9236-E4FCAE870F25),helpstring("Temp"),lcid(0x0409),version(1.0)]library Temp
    {
    [helpstring("Typesmodule"),version(1.0),dllname("Temp.dll")]module Typesmodule
    {
    struct point2d{double x,y;};
    struct line2d{point2d m1,m2;};
    }
    };
    error MIDL2025 : syntax error : expecting a type specification near "point2d"

    I'm working in Visual C++ 5.0. What do you mean by "C not C++"?
    Last edited by Helix; 08-26-2003 at 01:56 PM.

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    In C you may need to specify point2d is a struct:
    Code:
    struct line2d{struct point2d m1,m2;};}

  5. #5
    Registered User
    Join Date
    Jul 2003
    Posts
    32
    Oh my god, it works! I can't thank you enough.

    By the way, how was I suppose to know?! This odl stuff is most badly documented.

  6. #6
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    You may be able to tell from the file extension. In general C++ files have a .cpp extension. C files have a .c extension. Since most compilers will compile either, they use the extension to determine whether its C or C++.

    If your file has a .c extension, supposedly its C. But it's possible you could rename it to a .cpp, and the original code may compile. You might try this.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. read from file problem
    By Martin Kovac in forum C Programming
    Replies: 1
    Last Post: 04-13-2009, 08:33 AM
  2. Subtle(?) File I/O Problem
    By cecomp64 in forum C Programming
    Replies: 9
    Last Post: 07-16-2008, 11:39 AM
  3. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 03:44 PM
  4. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 01:19 PM
  5. Rename file problem
    By Emporio in forum C Programming
    Replies: 2
    Last Post: 06-05-2002, 09:36 AM