Solved

CommonDialog / file browsing

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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
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.

691 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