CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2003
    Posts
    4

    error LNK2001: unresolved external symbol __pctype

    When I compile and link a simple test program using VC++ 6.0 I get the following errors:
    error LNK2001: unresolved external symbol __pctype
    error LNK2001: unresolved external symbol ___mb_curr_max

    These symbols are not mine but are contained within two of my object modules.

    Does anyone know where these are defined and how I can eliminate the linker error? It appears to me that these symbols are part of VC++. They aren't part of my code.

  2. #2
    Join Date
    Sep 2003
    Location
    Forever Gone... For Now...
    Posts
    1,515
    What runtime are you linking with? (VC++ 6.0: Project | Settings | C/C++ | Code Generation | Use run-time library)
    Thought for the day/week/month/year:
    Windows System Error 4006:
    Replication with a nonconfigured partner is not allowed.

  3. #3
    Join Date
    Nov 2003
    Posts
    4
    I'm using the Debug Single-Theaded run time library.

  4. #4
    Join Date
    Sep 2003
    Location
    Forever Gone... For Now...
    Posts
    1,515
    Try the (debug) Multithreaded or (debug) Multithreaded DLL.
    Thought for the day/week/month/year:
    Windows System Error 4006:
    Replication with a nonconfigured partner is not allowed.

  5. #5
    Join Date
    Nov 2003
    Posts
    4
    Thanks for a little bit of progress. Included below are the error messages from compilation and links using each of the different runtime options.

    The errors that I encountered at first were with the Debug Single Threaded runtime package with an exclusion of the libcd.lib. I experimented with excluding this library because of the error message, similar to the one below, that indicated _fopen was alread defined in LIBCD.lib.

    These error messages were generated without any exclusions and with the runtime package identified in << >>. As you can see, only the (Debug) Multi-threaded DLL runtime allowed the link to finish.

    Can you help me understand why?

    Thanks again.
    << Runtime - (Debug) Single Threaded, (Debug) Multi-Threaded >>
    Linking...
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _printf already defined in LIBCMT.lib(printf.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _fclose already defined in LIBCMT.lib(fclose.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _fopen already defined in LIBCMT.lib(fopen.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _strncpy already defined in LIBCMT.lib(strncpy.obj)
    LINK : warning LNK4098: defaultlib "MSVCRTD" conflicts with use of other libs; use /NODEFAULTLIB:library
    Debug/TestReposit.exe : fatal error LNK1169: one or more multiply defined symbols found

    << Runtime Multi Threaded DLL >>
    Compiling...
    dumpmem.c
    strutil.c
    testReposit.cpp
    m:\src\test\testreposit\testreposit.cpp(74) : warning C4273: '_errno' : inconsistent dll linkage. dllexport assumed.
    Linking...
    LINK : warning LNK4098: defaultlib "MSVCRTD" conflicts with use of other libs; use /NODEFAULTLIB:library

    TestReposit.exe - 0 error(s), 2 warning(s)


    << Runtime - Debug Multi-Threaded DLL >>
    Compiling...
    dumpmem.c
    strutil.c
    testReposit.cpp
    m:\src\test\testreposit\testreposit.cpp(74) : warning C4273: '_errno' : inconsistent dll linkage. dllexport assumed.
    Linking...

    TestReposit.exe - 0 error(s), 1 warning(s)

  6. #6
    Join Date
    Sep 2003
    Location
    Forever Gone... For Now...
    Posts
    1,515
    Of course, you should realize you would use the DEBUG runtime in DEBUG builds, and the non-DEBUG runtime in RELEASE builds of your application.

    In short, you're likely using some static library (mysql? sqlite?) that was compiled with the multithreaded-dll option. Thus, your program should use the same CRT.

    You may be able to use the non-DLL MT CRT by messing with the /NODEFAULTLIB linker option, but I personally avoid such situations.
    Thought for the day/week/month/year:
    Windows System Error 4006:
    Replication with a nonconfigured partner is not allowed.

  7. #7
    Join Date
    Nov 2003
    Posts
    4
    Thanks for you help. I'm off and running again

  8. #8
    Join Date
    Jul 2012
    Posts
    1

    Re: error LNK2001: unresolved external symbol __pctype

    Hello, i also have the same problem. Here are the errors that occure while i'm building dream source code on visual studio 6:

    libfftw.lib(wisdom.obj) : error LNK2001: unresolved external symbol __pctype
    libfftw.lib(wisdom.obj) : error LNK2001: unresolved external symbol ___mb_cur_max
    Release/Dream.exe : fatal error LNK1120: 2 unresolved externals
    Error executing link.exe.

    Dream.exe - 3 error(s), 2 warning(s)

    Can someone help me please?

  9. #9
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: error LNK2001: unresolved external symbol __pctype

    Quote Originally Posted by miky228 View Post
    Hello, i also have the same problem.
    Well, seems like the solution is the same too, and you have to build with some multithreaded CRT flavor.
    Best regards,
    Igor

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured