random() and srandom() unresolved links - Page 2


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 2 of 2 FirstFirst 12
Results 16 to 26 of 26

Thread: random() and srandom() unresolved links

  1. #16
    Join Date
    Nov 2003
    Posts
    4,118
    btw, I've never cared for MINGW. I can't put my finger on the right spot but somehow it never really managed to do anything properly. I strongly recommend that you look for a more serious compiler for that traget platform.
    Danny Kalev

  2. #17
    Join Date
    Aug 2004
    Posts
    37
    Quote Originally Posted by jonnin
    Because the code is fine and the compiler is improperly installed or configured.
    do you think that the mingw toolset is not installed by default with c++ builderx ?
    but i tried a simple prog with mingw compiler and it works !

  3. #18
    Join Date
    Nov 2003
    Posts
    4,118
    It's not just a compiler issue. You also need to runtime libraries and a linker that supports that compiler's ABI. Additionally, you need to set the correct search paths for #includes, define the proper macros that enable the compiler to work properly and so on. It appears that C++ BuilderX doesn't have these by default. Again, withoyt looking at the precide code before and after preprocessing it's hard to tell where exactly the problem lies but I'll wager that it's MINGW.
    Danny Kalev

  4. #19
    Join Date
    Aug 2004
    Posts
    37
    Ooof ! at last i got it ; thanks God :-)

    it was a really hard hacking job : dealing with header files: CBX has a very bad habit to misuse include search paths...
    still remains a warning issue :
    my prog uses an enumarated constant :
    Code:
    enum	{IN=0, OUT=1};
    the compiler issues an error in the line of previous declaration(parsing error befor = )
    it seems that IN and OUT are standard built-in variables and mines are clashing with the standard ones.
    i get rid of this error by using :
    Code:
    #ifdef USING_CBX
      #define IN   ann_IN
      #define OUT  ann_OUT
    #endif
    now the program compiles but it issues lots of warnings : redefinition of variable IN and OUT.
    i want to know how to get rid of these warnings.
    thanks.

  5. #20
    Join Date
    Nov 2003
    Posts
    4,118
    IN and OUT aren't standard names but like any other all uppercase names, they may well be reserved by a specific implementation. I wouldn't use such names to begin with, and to reduce the likelihood of name clashes, you can use namespaces. That's what namespaces are for!

    namespace my_proj
    {
    enum { someprefix_in, someprefix out };
    }
    Danny Kalev

  6. #21
    Join Date
    Aug 2004
    Posts
    37
    Quote Originally Posted by Danny
    IN and OUT aren't standard names but like any other all uppercase names, they may well be reserved by a specific implementation. I wouldn't use such names to begin with, and to reduce the likelihood of name clashes, you can use namespaces. That's what namespaces are for!

    namespace my_proj
    {
    enum { someprefix_in, someprefix out };
    }
    my work is only a porting of a c++ library that was written for unix systems ...my job is to port it to windows borland platforms : so i'm not responsible for the choices of the original authors...
    it would be nice if i can disable the redefinition warnings by using some #pragrma for example ...
    is that possible ? how?
    thanks Indeed !

  7. #22
    Join Date
    Dec 2003
    Posts
    3,366
    Many compilers seem to define in and out as nothing:
    #define IN
    #define OUT
    for use in documentation:
    void function(IN int whatever, OUT some_value); etc...

  8. #23
    Join Date
    Aug 2004
    Posts
    37
    Quote Originally Posted by jonnin
    Many compilers seem to define in and out as nothing:
    #define IN
    #define OUT
    for use in documentation:
    void function(IN int whatever, OUT some_value); etc...
    you are right !
    after searching i found these (IN and OUT) defined in file <rpcdce.h>
    they are now clashing with my enumeration constants .
    is there a clever way to prevent this?

    ps: i'm now getting an error instead of warning : a problem !

    please help !

    thanks

  9. #24
    Join Date
    Aug 2004
    Posts
    37
    Finaly i'm now getting 0 errors 0 warnings !
    the trick was to set a warning option for CBX : "do not predefine any system-specific macros"

    a conclusion would be that Borland c++ builderX is a complicated IDE ! you need to be very carefull to properly set the build options...the documentation didn't raised these tricky issues : Borland needs to improve this in future.

    I want here to thank Jonnin and Danny for their precious help : they were very patient and generous with me ; so many thanks for you guys again !

  10. #25
    Join Date
    Dec 2003
    Posts
    3,366
    Your always welcome -- and I learned as much as I gave on this one, having not used that compiler.

  11. #26
    Join Date
    Nov 2003
    Posts
    4,118
    Great; mysery solved. However, to facilitate additional future ports by youself and perhaps others, I would strongly recommend that you got rid of the IN and OUT enumartors. Even though you're only porting existing code, it's going to be a serious pain every time anew. Don't try to bypass it by disabling compilers' default settings because future versions and future IDEs might not like it. The safest thing to do is to replace these enums with less clah-prone names or group them in a namespace. Just a thought.
    Danny Kalev

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center