Using CfileFind and it will not link

This is a discussion on Using CfileFind and it will not link within the C++ Programming forums, part of the General Programming Boards category; #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; ...

  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
    zen
    zen is offline
    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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21