?
Solved

CommonDialog / file browsing

Posted on 2002-04-15
3
Medium Priority
?
241 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
ambience earned 800 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
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.
Suggested Courses

800 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