Thread: Using libraries from different compilers

  1. #1
    Registered User OnionKnight's Avatar
    Join Date
    Jan 2005
    Posts
    555

    Using libraries from different compilers

    Not sure if this is the right place to ask this question, but is it possible to use the libraries from one compilers with another compiler without problems? For example, using Borland's conio library with GCC. Would be as simple as adding the Borland library path in the list of GCC libraries and the include path to the list of includes?

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Would be as simple as adding the Borland library path in the list of
    >GCC libraries and the include path to the list of includes?
    No, but it would be a learning experience to try and see what happens.
    My best code is written with the delete key.

  3. #3
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    I've tried this before. It's not such a good idea. The library will conflict with other libraries that they don't belong with and you'll be in a worse off position than when you started.

    I would say, if there is a library that has a function you need, then just get the code for that function and add it to your program. Then if you're gonna give out the source code, give credit where credit is due.
    Sent from my iPadŽ

  4. #4
    Registered User OnionKnight's Avatar
    Join Date
    Jan 2005
    Posts
    555
    I tried it and got this using some old code and the MSVC++ compiler.
    The linker didn't like it.

    Code:
    nibbles.obj : error LNK2001: unresolved external symbol _gotoxy
    nibbles.obj : error LNK2001: unresolved external symbol _wherex
    nibbles.obj : error LNK2001: unresolved external symbol _clrscr
    nibbles.obj : error LNK2001: unresolved external symbol _textbackground
    nibbles.obj : error LNK2001: unresolved external symbol _textcolor
    nibbles.obj : error LNK2001: unresolved external symbol __setcursortype
    However I tried making a test app and it could do cprintf without a problem. Before building the above program I had some problems compiling too. Like, _NOCURSOR wasn't defined. Which is weird because it is in the include file. Maybe it didn't even include it. But if it didn't wouldn't it produce an error?

    Edit: MSVC++ had it's own conio.h. I don't feel like messing around with it's stuff so I give up, will it work or not?
    Last edited by OnionKnight; 10-29-2005 at 10:27 PM.

  5. #5
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    You're trying to move Borlands conio.h to your compiler, but I can tell you that most of those functions can be found in other libraries on your compiler.

    Check windows.h.
    Sent from my iPadŽ

  6. #6
    Registered User OnionKnight's Avatar
    Join Date
    Jan 2005
    Posts
    555
    No, if anything I am trying to stick to only one compiler instead of having a million of them everywhere taking up a bunch of space.
    I am mostly just curious.

  7. #7
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >No, if anything I am trying to stick to only one compiler instead of
    >having a million of them everywhere taking up a bunch of space.
    Actually, it's a good idea to have at least three unique compilers if you're serious about programming. That way you can test on all three and be reasonably confident that your code doesn't rely on the quirks of any one compiler.
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with compilers and their libraries
    By Onchei in forum C++ Programming
    Replies: 8
    Last Post: 07-04-2008, 01:38 PM
  2. MinGW thread-safe runtime libraries
    By Mario F. in forum C++ Programming
    Replies: 3
    Last Post: 08-21-2006, 08:15 AM
  3. C++ Builder Comparison
    By ryanlcs in forum Tech Board
    Replies: 14
    Last Post: 08-20-2006, 09:56 AM
  4. General Libraries question
    By subnet_rx in forum C++ Programming
    Replies: 1
    Last Post: 09-14-2004, 01:17 AM
  5. QT and external libraries
    By Quacker in forum Linux Programming
    Replies: 1
    Last Post: 04-08-2003, 07:02 AM