Thread: Trouble with MSVC, Mingw32 and Code::Blocks

  1. #1
    Making mistakes
    Join Date
    Dec 2008
    Posts
    476

    Trouble with MSVC, Mingw32 and Code::Blocks

    Hi everyone, I got myself MSVC 2003, because I wanted to try it. Now I have Mingw32 and MSVC in Codeblocks, But when I try to compile a file it says:

    Fatal Error LNK1181: cannot open input file 'mingw32.lib'

    1. WTH Is MSVC trying to get this file?
    2. It doesn't exist. What can I do?
    3. I tried to link against 'libmingw32.a'. But It won't help either.

    Please, can anybody help me?

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Probably Code::Blocks doing something wrong, I expect - or perhaps you've been messing with the configuration of the project yourself.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    The larch
    Join Date
    May 2006
    Posts
    3,573
    Do you specify under project build options that you want to link with that library? Don't if you are building with VC++...
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  4. #4
    Making mistakes
    Join Date
    Dec 2008
    Posts
    476
    Which library? SDL? Mingw32?

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Brafil View Post
    Which library? SDL? Mingw32?
    mingw32 is not supposed to be linked with MS compiler code. It is a compiler specific library for gcc-mingw.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #6
    Making mistakes
    Join Date
    Dec 2008
    Posts
    476
    hmmm. I tried, but now it says the same with libcpd.lib -.-
    Last edited by Brafil; 12-08-2008 at 10:55 AM.

  7. #7
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    State what exactly you did to install and configure the tools in question.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  8. #8
    Making mistakes
    Join Date
    Dec 2008
    Posts
    476
    Well, I linked MSVC with the MSVC version of SDL: SDLmain.lib and SDL.lib. It searches in:
    SDL\lib and Python\lib. What's wrong?

    PS: Im trying to solve it, because there is a libmscvrt.a in the mingw directory. But It ISN'T Linked with it!

    PPS: with GCC it says
    /W3: No such file or directory
    /Zi : as above
    /D_DEBUG: the same again.
    Last edited by Brafil; 12-08-2008 at 11:39 AM.

  9. #9
    The larch
    Join Date
    May 2006
    Posts
    3,573
    PPS: with GCC it says
    /W3: No such file or directory
    /Zi : as above
    /D_DEBUG: the same again.
    These should be VC++ specific compiler flags which GCC doesn't understand.

    Basically, you probably shouldn't switch the compiler while compiling the same project if you don't want to edit the project settings every time.

    And probably the first thing to do with a new compiler is to see whether you get a simple hello world to compile.

    Code:
    #include <stdio.h>
    int main(void)
    {
        puts("Hello world");
        return 0;
    }
    Then you can work on from there.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  10. #10
    Making mistakes
    Join Date
    Dec 2008
    Posts
    476
    Well, I had to format my computer, and now hello world works with MSVC. I'm going to test it with GCC now. It always says:
    ...\ld.exe: crtbegin.o: No such file or directory.

    I know that's the 1000x time, but I already tried it about 20 times.

    EDIT 2: It works now, I just mixed some versions of Mingw together and it didn't go well
    Last edited by Brafil; 12-10-2008 at 04:23 AM.

  11. #11
    Making mistakes
    Join Date
    Dec 2008
    Posts
    476
    Help me, please! I'm gonna get crazy! I installed Platform and .Net SDK, but now it says

    ...

    PS:
    I linked it with a downloaded msvcprt.lib and the original (Platform SDK) mscrt.lib.
    But now it says: fatal error LNK1561: entry point must be defined
    Last edited by Brafil; 12-10-2008 at 08:13 AM.

  12. #12
    Registered User
    Join Date
    Oct 2009
    Posts
    1
    Hi Brafil,

    I don't know if this will help you but I was experiencing a similar error with CodeLite using wxWidgets.

    To solve the problem, I added the path to the lib files to the Library Path of the "Linker". Remember that the compiler settings and linker setting are for two separate programs.

    So, for linker issues like this:
    Fatal Error LNK1181: cannot open input file 'mingw32.lib'

    You need to change the linker settings for that Project.

    Hope this helps

Popular pages Recent additions subscribe to a feed