Thread: MS Visual C++ 6.0 Linking Error

  1. #1
    Just kidding.... fnoyan's Avatar
    Join Date
    Jun 2003
    Location
    Still in the egg
    Posts
    275

    MS Visual C++ 6.0 Linking Error

    Hi
    I have a program that communicates with serial port. In compiling process there is no error but while buildind the obj file I get some errors!

    --------------------Configuration: StdAfx - Win32 Debug--------------------
    Linking...
    nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
    nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
    libcd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/StdAfx.exe : fatal error LNK1120: 3 unresolved externals
    Error executing link.exe.

    StdAfx.exe - 4 error(s), 0 warning(s)

    Do I have to include extra libraries in order to avoid such errors!? All the header files are available in appropriate fokders.

    Thanks...

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    What kind of project did you specify when you started the program? I seem to recall this type of error a while back but it has been a long time... I can't remember exactly but you may need to go under Project->Settings->General Tab->Microsoft Foundation Classes and make sure that either of the two "Use MFC in a... " options are selected and that should get rid of the two threadex error messages (I think that's it but I could be wrong). As for the "main" error message it just looks like your project needs a main function created.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  3. #3
    Registered User mitakeet's Avatar
    Join Date
    Jun 2005
    Location
    Maryland, USA
    Posts
    212
    Make sure you are using multi-threaded libraries.

    Free code: http://sol-biotech.com/code/.

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw

  4. #4
    Banal internet user
    Join Date
    Aug 2002
    Posts
    1,380
    You need to specify the /MT, /MTD, or /MD switch with the linker. I haven't used VC6 in a while, but your project properties should have an option for it like this:

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 04:09 AM
  2. How to monitor process creation?
    By markiz in forum Windows Programming
    Replies: 31
    Last Post: 03-17-2008, 02:39 PM
  3. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM
  4. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM
  5. header file bringing errors?
    By bluehead in forum Windows Programming
    Replies: 4
    Last Post: 08-19-2003, 12:51 PM