Solved

CommonDialog / file browsing

Posted on 2002-04-15
3
234 Views
Last Modified: 2012-06-27
Hey everyone, all i am trying to do is bring up a CFileDialog window to select some files.
I am using VC++, opengl in a window (not mfc, but api)
Ive tried several code bits but none seem to work.
When i try to create an instance of CFileDialog, i get the following linker errors:

nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in LIBCD.lib(new.obj)
nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in LIBCD.lib(dbgdel.obj)
nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int,int,char const *,int)" (??2@YAPAXIHPBDH@Z) already defined in LIBCD.lib(dbgnew.obj)
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex


any ideas how to get a file browsing thingy up?
0
Comment
Question by:GoldStone32767
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
ambience earned 200 total points
ID: 6943888
If you are not using MFC then why bother about CFileDialog ??

Why not use API for this

    OPENFILENAME ofn={0};
    TCHAR filename[MAX_PATH];
    filename[0]= 0;

    ofn.lStructSize       = sizeof(OPENFILENAME);
    ofn.lpstrFilter       = _T("Text Files\0*.txt\0\0");
    ofn.lpstrFile         = filename;
    ofn.lpstrTitle        = TEXT("Open Media File...\0");
    ofn.Flags             = OFN_FILEMUSTEXIST | OFN_READONLY | OFN_PATHMUSTEXIST;
   
    if(GetOpenFileName((LPOPENFILENAME)&ofn))
    {
       // filename now has filename
    }

//////////////////////////////////

And another solution is to
to put LIBCD.LIB in the ignore lib edit box from project settings.

For __beginthreadex etc. you need to select multi-threaded CRT library for your project.

do this by opening C/C++ tab in project settings.
Select code-generation category and select Debug-multithreaded for Use rumtime library (debug mode). And multithreaded for Release mode.
0
 
LVL 22

Expert Comment

by:ambience
ID: 6943893
for the ignore part its in Link tab of project settings under Input category.
0
 

Author Comment

by:GoldStone32767
ID: 6945967
Works Perfect! its exacly what i needed. Thank you very much for your time
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question