[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

CommonDialog / file browsing

Posted on 2002-04-15
3
Medium Priority
?
245 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

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
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…
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 member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

650 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