Thread: Using CfileFind and it will not link

  1. #1
    hamilton7
    Guest

    Using CfileFind and it will not link

    #include <stdio.h>
    #include <iostream.h>
    #include <fstream.h>
    #include <stdlib.h>
    #include <string.h>
    #include <afx.h>


    //#define macros here
    main(){
    char name[20]="";
    CFileFind finder;
    BOOL bWorking = finder.FindFile("*.*");
    while (bWorking)
    {
    bWorking = finder.FindNextFile();
    cout << (LPCTSTR) finder.GetFileName() << endl;
    }
    return 1;
    }

    When I try to build an executable the program gives me the following errors

    nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
    nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex

    I am using Microsoft Visual 5.0 C++
    What do I need to do I have tried for two days to make this work the sample code comes directly from the help file.

  2. #2
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    I'm not sure of the exact settings for MSVC 5.0, but you need to link with the multi-threaded libraries (something like project/settings,c/c++ tab, code generation) and specifiy in your project settings that you are using MFC (either using the dll's or static library).
    zen

Popular pages Recent additions subscribe to a feed
Website Security Test