Can I develop a MFC or Windows SDK based C++ application?

Can I develop a MFC or Windows SDK based C++ application?

Dear Friends I am currently using MS Visual Studio 2008 as my IDE for development and C++ as my programming language. I would like to know if I can develop an application using MFC or the APIs supported by Windows SDK for this platform as it has support for 1. Rich UI, graphics, Windows, 2. Mouse handling and 3. Network interaction etc. Or do I need to write / use third party libraries written in pure C and C++ which are able to do that for me. Regards, Abhijeet
18 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Chandra Destiawan's picture

You can refer to http://appdeveloper.intel.com/en-us/article/facebook-example-windows . I think it's the best example for you

Also I checked the Component catalog and found components developed using MFC which I guess confirms that I can use MFC and Windows APIs for development.

Please suggest..

Regards,
Abhijeet

Andre (Intel)'s picture

Hello Abhijeet,

as long as you use the Visual Studio 2008 compiler for C/C++ it doesn't matter if its MFC, native ISO C++ etc.
Just make sure you implement the SDK APIs.

Best Regards,

Andre B.

Intel® Atom™ Developer Program

Hi Andre,

Thanks for a quick response.
Will get back in case I have more queries.

Br,
Abhijeet.

Greetings Andre,

How about using C# or Managed C++ for developing my app as it compiles using MS Visual Studio 2008
To put it in other words, is .net environment supported for application development for Windows based netbooks ?

Best Regards,
Abhijeet

Andre (Intel)'s picture

Hello Abhijeet,

currently .NET languages in all its variations are not supported. Only pure C/C++ applications and components.

This is a common community question and we are aware that .NET is framework developers wish to use.

Best Regards,

Andre B.

Intel® Atom™ Developer Program

Hi Andre,
We are trying to meet the deadline. We are porting apps from iPhone to Atom. And we are somewhat new to windows.

Are forms based (CLR) applications ok ? We are using C++ on Visual Studio 2008.

If not, what is the simplest way of developing GUI ?

Will appreciate if you respond soon.

BrianDevArch's picture

Observer,

Intel states that Visual Studio 2008 C++ is supported. Anything other than that is up to the developer to implement and handle all issues that arise. Some developers are using C++ CLR, but it is not supported by Intel. You will need to create a CLR Managed Wrapper to implement the ATOM SDK functions correctly. Your MSI installer must also ensure all required libraries are included. Please see this link for more detail on the validation process:

http://appdeveloper.intel.com/en-us/article/validation-guidelines

Additional Note: MFC is the route chosen by most as that is supported by Intel.

Is there a step by step guide on how to create a MFC project to work with the SDK?
for example, i have tried to add a MFC dialog app (which i think is the simplest form of MFC)

in the app class' source file, i put #include "adpcppf.h" //includes all required C++ headers

in the app class's InitInstance(), i put this

Application * myApplication = NULL;
ApplicationId myApplicationId = ADP_DEBUG_APPLICATIONID;

it has a lots of errors involving the linkers. is there any specific settings i need to set at the project settings?

BrianDevArch's picture

Leow,

Please post your linker errors so we can review them. It may be as simple as your include order.

in the project properties,
linker\input: debug configuration, i set 'Ignore all default libraries' to Yes. Choosing No also have as many errors
additional dependencies : adpcored.lib psapi.lib shlwapi.lib adpcppfd.lib
Linker: all configurations
general\additional library directories: C:\Program Files\Intel\Intel Atom Developer Program SDK\0.91\lib

c++: all configurations
general\additional include directories: C:\Program Files\Intel\Intel Atom Developer Program SDK\0.91\include

here are the errors i get.

Warning 1 warning LNK4199: /DELAYLOAD:OleAcc.dll ignored; no imports found from OleAcc.dll HappyChef HappyChef
Error 2 error LNK2001: unresolved external symbol _wWinMainCRTStartup HappyChef HappyChef
Error 3 error LNK2001: unresolved external symbol __afxForceEXCLUDE HappyChef.obj HappyChef
Error 4 error LNK2001: unresolved external symbol __afxForceEXCLUDE HappyChefDlg.obj HappyChef
Error 5 error LNK2001: unresolved external symbol __afxForceEXCLUDE stdafx.obj HappyChef
Error 6 error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) adpcored.lib HappyChef
Error 7 error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) adpcppfd.lib HappyChef
Error 8 error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) stdafx.obj HappyChef
Error 9 error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) adpcored.lib HappyChef
Error 10 error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) adpcored.lib HappyChef
Error 11 error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) adpcored.lib HappyChef
Error 12 error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) HappyChef.obj HappyChef
Error 13 error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) HappyChef.obj HappyChef

continues with the list of errors in subsequent thread

BrianDevArch's picture

A few suggestions:

1.) Do not ignore all default libraries
2.) Include ""C:\Program Files\Intel\Intel Atom Developer Program SDK\0.9\include"" in the Include Directories
3.) Include ""C:\Program Files\Intel\Intel Atom Developer Program SDK\0.9\lib"" in the Additional Library Directories
4.) Add "adpcored.lib adpcppfd.lib psapi.lib shlwapi.lib" to the Additional Dependencies under the linker settings

This should get you much closer. Please post back if you have any trouble.

dear BrianDevArch

i modify (1) as you mentioned. (2)-(4) is what i originaly have
should i use 'precompiled headers' under c/C++ settings?

i have less errors now

Error 1 error LNK2005: _wcstombs_s already defined in libcmtd.lib(wcstombs.obj) MSVCRTD.lib HappyChef
Error 2 error LNK2005: _wcslen already defined in libcmtd.lib(wcslen.obj) MSVCRTD.lib HappyChef
Error 3 error LNK2005: _strcpy_s already defined in libcmtd.lib(strcpy_s.obj) MSVCRTD.lib HappyChef
Error 4 error LNK2005: _malloc already defined in libcmtd.lib(dbgmalloc.obj) MSVCRTD.lib HappyChef
Error 5 error LNK2005: _strncpy_s already defined in libcmtd.lib(strncpy_s.obj) MSVCRTD.lib HappyChef
Error 6 error LNK2005: ___iob_func already defined in libcmtd.lib(_file.obj) MSVCRTD.lib HappyChef
Error 7 error LNK2005: _free already defined in libcmtd.lib(dbgfree.obj) MSVCRTD.lib HappyChef
Error 8 error LNK2005: __invalid_parameter already defined in libcmtd.lib(invarg.obj) MSVCRTD.lib HappyChef
Error 9 error LNK2005: __CrtDbgReportW already defined in libcmtd.lib(dbgrptw.obj) MSVCRTD.lib HappyChef
Error 10 error LNK2005: "public: virtual __thiscall std::exception::~exception(void)" (??1exception@std@@UAE@XZ) already defined in libcmtd.lib(stdexcpt.obj) MSVCRTD.lib HappyChef
Error 11 error LNK2005: "public: __thiscall std::exception::exception(void)" (??0exception@std@@QAE@XZ) already defined in libcmtd.lib(stdexcpt.obj) MSVCRTD.lib HappyChef
Error 12 error LNK2005: "public: __thiscall std::exception::exception(class std::exception const &)" (??0exception@std@@QAE@ABV01@@Z) already defined in libcmtd.lib(stdexcpt.obj) MSVCRTD.lib HappyChef
Error 13 error LNK2005: _vswprintf_s already defined in libcmtd.lib(vswprnc.obj) MSVCRTD.lib HappyChef
Error 14 error LNK2005: "public: __thiscall std::exception::exception(char const * const &)" (??0exception@std@@QAE@ABQBD@Z) already defined in libcmtd.lib(stdexcpt.obj) MSVCRTD.lib HappyChef
Error 15 error LNK2005: _wcscmp already defined in libcmtd.lib(wcscmp.obj) MSVCRTD.lib HappyChef
Error 16 error LNK2005: __itow_s already defined in libcmtd.lib(xtows.obj) MSVCRTD.lib HappyChef
Error 17 error LNK2005: _sprintf already defined in libcmtd.lib(sprintf.obj) MSVCRTD.lib HappyChef
Error 18 error LNK2005: _strtoul already defined in libcmtd.lib(strtol.obj) MSVCRTD.lib HappyChef
Error 19 error LNK2005: _strncmp already defined in libcmtd.lib(strncmp.obj) MSVCRTD.lib HappyChef
Error 20 error LNK2005: _atol already defined in libcmtd.lib(atox.obj) MSVCRTD.lib HappyChef
Error 21 error LNK2005: _strtol already defined in libcmtd.lib(strtol.obj) MSVCRTD.lib HappyChef
Error 22 error LNK2005: _strchr already defined in libcmtd.lib(strchr.obj) MSVCRTD.lib HappyChef
Error 23 error LNK2005: __write already defined in libcmtd.lib(write.obj) MSVCRTD.lib HappyChef
Error 24 error LNK2005: __read already defined in libcmtd.lib(read.obj) MSVCRTD.lib HappyChef
Error 25 error LNK2005: _strrchr already defined in libcmtd.lib(strrchr.obj) MSVCRTD.lib HappyChef
Error 26 error LNK2005: _mbtowc already defined in libcmtd.lib(mbtowc.obj) MSVCRTD.lib HappyChef
Error 27 error LNK2005: ____mb_cur_max_func already defined in libcmtd.lib(initctyp.obj) MSVCRTD.lib HappyChef
Error 28 error LNK2005: _wctomb already defined in libcmtd.lib(wctomb.obj) MSVCRTD.lib HappyChef
Error 29 error LNK2005: __isnan already defined in libcmtd.lib(_ieeemisc_.obj) MSVCRTD.lib HappyChef
Error 30 error LNK2005: __gmtime64 already defined in libcmtd.lib(gmtime64.obj) MSVCRTD.lib HappyChef
Error 31 error LNK2005: _strftime already defined in libcmtd.lib(strftime.obj) MSVCRTD.lib HappyChef
Error 32 error LNK2005: _memmove already defined in libcmtd.lib(memmove.obj) MSVCRTD.lib HappyChef
Error 33 error LNK2005: _strcat_s already defined in libcmtd.lib(strcat_s.obj) MSVCRTD.lib HappyChef
Error 34 error LNK2005: _wcscat_s already defined in libcmtd.lib(wcscat_s.obj) MSVCRTD.lib HappyChef
Error 35 error LNK2005: _wcscpy_s already defined in libcmtd.lib(wcscpy_s.obj) MSVCRTD.lib HappyChef
Error 36 error LNK2005: _memcpy_s already defined in libcmtd.lib(memcpy_s.obj) MSVCRTD.lib HappyChef
Error 37 error LNK2005: __localtime64_s already defined in libcmtd.lib(loctim64.obj) MSVCRTD.lib HappyChef
Error 38 error LNK2005: _sprintf_s already defined in libcmtd.lib(sprintf.obj) MSVCRTD.lib HappyChef
Error 39 error LNK2005: _vsprintf_s already defined in libcmtd.lib(vsnprnc.obj) MSVCRTD.lib HappyChef
Error 40 error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in libcmtd.lib(typinfo.obj) MSVCRTD.lib HappyChef
Error 41 error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in libcmtd.lib(typinfo.obj) MSVCRTD.lib HappyChef
Error 42 error LNK2005: __stricmp already defined in libcmtd.lib(stricmp.obj) MSVCRTD.lib HappyChef
Warning 43 warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library HappyChef HappyChef
Error 44 fatal error LNK1169: one or more multiply defined symbols found C:\Documents and Settings\chealeow\My Documents\Visual Studio 2008\Projects\HappyChef\Debug\HappyChef.exe HappyChef

and here is the code i have. the line 'ApplicationId myApplicationId = ADP_DEBUG_APPLICATIONID;' is teh one creating the errors. I haven't even start to use the myApplicationId yet

BOOL CHappyChefApp::InitInstance()
{
// InitCommonControlsEx() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles. Otherwise, any window creation will fail.
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// Set this to include all the common control classes you want to use
// in your application.
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);

CWinAppEx::InitInstance();

Application * myApplication = NULL;
ApplicationId myApplicationId = ADP_DEBUG_APPLICATIONID;
//ApplicationId myApplicationId( 0x00000000, 0x12129090, 0xF0F0ABAB, 0x00006262);

// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need
// Change the registry key under which our settings are stored
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization
SetRegistryKey(_T("Local AppWizard-Generated Applications"));

CHappyChefDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}

// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}

BrianDevArch's picture

There is some progress. Next thing to try:

Check your include order. Try placing the ATOM include last or first and ignoring default libraries.

Example from sdtafx.h:

#include // MFC core and standard components
#include // MFC extensions
#include // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STDAFX_H__DDE4FAE8_3AAE_11D6_9528_814C36560D2A__INCLUDED_)

#include "adpcppf.h" //includes all required C++ headers

i tried placing it at different location in the stdafx.h file

placing it at the very beginning has the least error

Error 1 fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxv_w32.h 16 HappyChef

here is my stdafx.h file. what else can i try? the linker ignore default libraries, it make no difference

// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently

#include "adpcppf.h" //includes all required C++ headers

#pragma once

#ifndef _SECURE_ATL
#define _SECURE_ATL 1
#endif

#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#endif

#include "targetver.h"

#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit

// turns off MFC's hiding of some common and often safely ignored warning messages
#define _AFX_ALL_WARNINGS

#include // MFC core and standard components
#include // MFC extensions

#ifndef _AFX_NO_OLE_SUPPORT
#include // MFC support for Internet Explorer 4 Common Controls
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT

#include // MFC support for ribbons and control bars

#include // HTML Dialogs

#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif

Absolutely. Did anyone reply to this ? They mention plenty of examples only the only examples I see are simple CONSOLE apps from the SDK. I don't see a usable example of a complex MFC app. Perhaps I have missed something.

Login to leave a comment.