Solved

CommonDialog / file browsing

Posted on 2002-04-15
3
228 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now