Mixing MFC and Console system with VC++5 (code included) 
Author Message
 Mixing MFC and Console system with VC++5 (code included)

to me, it looks like you need to add the library nafxcwd.lib to your links.
That's all. You know how to link it, right? ^_^ Good luck and have fun!
Quote:

>Hi,

>Can someone help me out please,

>I can't get the code (see below) compiled, the error is also included in
>this post.
>I used the MFVC Wizard to start a "console" project. Because I also want to
>use some MFC
>I made a "test" code, as seen below.
>(idea of the code is to have MFC "hidden" behind "normal"  C/C++ code)
>But I cant get it working, why o why ?

>Thanks for your help
>Jerry.
>+++++

>#include <iostream>
>#include <string>

>using namespace std;

>string fileFind();

>void main()
>{
> string test = fileFind();
> cout << test << endl;
>}

>+++++

>#include <afxwin.h>         // MFC core and standard components

>#include <string>
>#include <sstream>
>#include <iostream>

>using namespace std;

>string fileFind()
>{
> CFileFind finder;
> BOOL bWorking = finder.FindFile("c:/data/*.txt");
> CString name;
> if (bWorking)

>  bWorking = finder.FindNextFile();
>  name = finder.GetFileName();
> }

> ostringstream outputline;
> for(int i=0;i<name.GetLength();i++)
>  outputline << name.GetAt(i);

> string rval = outputline.str();
> return rval;
>}

>+++++

>The Error:

>--------------------Configuration: MFCDllUser01 - Win32
>Debug--------------------
>Linking...
>nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol
>__endthreadex
>nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol
>__beginthreadex
>Debug/MFCDllUser01.exe : fatal error LNK1120: 2 unresolved externals
>Error executing link.exe.

>MFCDllUser01.exe - 3 error(s), 0 warning(s)

>++++



Mon, 16 Jul 2001 03:00:00 GMT  
 Mixing MFC and Console system with VC++5 (code included)
To me, it looks like you only need to link the library nafxcwd.lib. You know
how to link it, right? Good Luck and Have fun! ^_^
Quote:

>Hi,

>Can someone help me out please,

>I can't get the code (see below) compiled, the error is also included in
>this post.
>I used the MFVC Wizard to start a "console" project. Because I also want to
>use some MFC
>I made a "test" code, as seen below.
>(idea of the code is to have MFC "hidden" behind "normal"  C/C++ code)
>But I cant get it working, why o why ?

>Thanks for your help
>Jerry.
>+++++

>#include <iostream>
>#include <string>

>using namespace std;

>string fileFind();

>void main()
>{
> string test = fileFind();
> cout << test << endl;
>}

>+++++

>#include <afxwin.h>         // MFC core and standard components

>#include <string>
>#include <sstream>
>#include <iostream>

>using namespace std;

>string fileFind()
>{
> CFileFind finder;
> BOOL bWorking = finder.FindFile("c:/data/*.txt");
> CString name;
> if (bWorking)

>  bWorking = finder.FindNextFile();
>  name = finder.GetFileName();
> }

> ostringstream outputline;
> for(int i=0;i<name.GetLength();i++)
>  outputline << name.GetAt(i);

> string rval = outputline.str();
> return rval;
>}

>+++++

>The Error:

>--------------------Configuration: MFCDllUser01 - Win32
>Debug--------------------
>Linking...
>nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol
>__endthreadex
>nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol
>__beginthreadex
>Debug/MFCDllUser01.exe : fatal error LNK1120: 2 unresolved externals
>Error executing link.exe.

>MFCDllUser01.exe - 3 error(s), 0 warning(s)

>++++



Mon, 16 Jul 2001 03:00:00 GMT  
 Mixing MFC and Console system with VC++5 (code included)
Hi,

Can someone help me out please,

I can't get the code (see below) compiled, the error is also included in
this post.
I used the MFVC Wizard to start a "console" project. Because I also want to
use some MFC
I made a "test" code, as seen below.
(idea of the code is to have MFC "hidden" behind "normal"  C/C++ code)
But I cant get it working, why o why ?

Thanks for your help
Jerry.
+++++

#include <iostream>
#include <string>

using namespace std;

string fileFind();

void main()
{
 string test = fileFind();
 cout << test << endl;

Quote:
}

+++++

#include <afxwin.h>         // MFC core and standard components

#include <string>
#include <sstream>
#include <iostream>

using namespace std;

string fileFind()
{
 CFileFind finder;
 BOOL bWorking = finder.FindFile("c:/data/*.txt");
 CString name;
 if (bWorking)

  bWorking = finder.FindNextFile();
  name = finder.GetFileName();
 }

 ostringstream outputline;
 for(int i=0;i<name.GetLength();i++)
  outputline << name.GetAt(i);

 string rval = outputline.str();
 return rval;

Quote:
}

+++++

The Error:

--------------------Configuration: MFCDllUser01 - Win32
Debug--------------------
Linking...
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol
__endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol
__beginthreadex
Debug/MFCDllUser01.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

MFCDllUser01.exe - 3 error(s), 0 warning(s)

++++



Tue, 17 Jul 2001 03:00:00 GMT  
 Mixing MFC and Console system with VC++5 (code included)

Quote:

> --------------------Configuration: MFCDllUser01 - Win32
> Debug--------------------
> Linking...
> nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol
> __endthreadex
> nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol
> __beginthreadex
> Debug/MFCDllUser01.exe : fatal error LNK1120: 2 unresolved externals
> Error executing link.exe.

> MFCDllUser01.exe - 3 error(s), 0 warning(s)

> ++++

Probably you didn't specify multithreading for your application. Try to
enable it in the project settings. If this doesn't help, "msvcrt.lib" is
the import library where the two missing functions are defined.

Hth.
--
Markus Schoepflin                         www:   http://www.ginit.de

Informationssysteme mbH                   phone: +49 721 9 66 81 67
Vincenz-Priessnitz-Str. 1                 fax:   +49 721 9 66 81 11
D-76131 Karlsruhe, Germany



Tue, 17 Jul 2001 03:00:00 GMT  
 Mixing MFC and Console system with VC++5 (code included)

----------------Configuration: MFCDllUser01 - Win32

Quote:
>Debug--------------------
>Linking...
>nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol
>__endthreadex
>nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol
>__beginthreadex
>Debug/MFCDllUser01.exe : fatal error LNK1120: 2 unresolved externals
>Error executing link.exe.

MFC is multithreaded. Change the project settings to use the multithreaded C
RTL and it should work fine.

Chris
-----------------------------------------------------------------------

Visit our web site at http://www.skymap.com
Astronomy software written by astronomers, for astronomers



Tue, 17 Jul 2001 03:00:00 GMT  
 Mixing MFC and Console system with VC++5 (code included)
Have you tried AppWizard option to generate console app with the MFC
support?


Quote:
>Hi,

>Can someone help me out please,

>I can't get the code (see below) compiled, the error is also included in
>this post.
>I used the MFVC Wizard to start a "console" project. Because I also want to
>use some MFC
>I made a "test" code, as seen below.
>(idea of the code is to have MFC "hidden" behind "normal"  C/C++ code)
>But I cant get it working, why o why ?

>Thanks for your help
>Jerry.
>+++++

>#include <iostream>
>#include <string>

>using namespace std;

>string fileFind();

>void main()
>{
> string test = fileFind();
> cout << test << endl;
>}

>+++++

>#include <afxwin.h>         // MFC core and standard components

>#include <string>
>#include <sstream>
>#include <iostream>

>using namespace std;

>string fileFind()
>{
> CFileFind finder;
> BOOL bWorking = finder.FindFile("c:/data/*.txt");
> CString name;
> if (bWorking)

>  bWorking = finder.FindNextFile();
>  name = finder.GetFileName();
> }

> ostringstream outputline;
> for(int i=0;i<name.GetLength();i++)
>  outputline << name.GetAt(i);

> string rval = outputline.str();
> return rval;
>}

>+++++

>The Error:

>--------------------Configuration: MFCDllUser01 - Win32
>Debug--------------------
>Linking...
>nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol
>__endthreadex
>nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol
>__beginthreadex
>Debug/MFCDllUser01.exe : fatal error LNK1120: 2 unresolved externals
>Error executing link.exe.

>MFCDllUser01.exe - 3 error(s), 0 warning(s)

>++++



Tue, 17 Jul 2001 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Mixing MFC and Console system with VC++5 (code included)

2. Mixing MFC and Console system with VC++5 (code included)

3. Mixed includes with stlport and VC.NET

4. mfc c++ / console c mixing

5. System.ExecutionEngineException - mixing managed/unmanaged code

6. Mixing MFC and win32 code

7. How to mix MFC and C code ????

8. How to install System Wide Hooks, Sample code included working for installing app

9. FP in VC & Mixing VC and gcc

10. FP in VC & Mixing VC and gcc

11. Including MFC code in SDK application

12. Include old c-code in an mfc environment

 

 
Powered by phpBB® Forum Software