Author Topic: What does it take to compile a ^%$ MFC app?  (Read 19124 times)

Offline Crazy_Eddie

  • Single posting newcomer
  • *
  • Posts: 3
What does it take to compile a ^%$ MFC app?
« on: May 27, 2005, 10:00:04 pm »
I'm at my wit's end here, and mostly it's that I feel like a moron because I can't seem to do what anyone here has done without much difficulty.
   I think my problem is I'm lacking a particular package or SDK. When I try to compile any MFC proggy, or any WinAPI proggy with a rc file, it tells me it can't open nafxcw.lib. I've found in the platform SDK versions for 64-bit processors, but despite repeated uninstalls & reinstalls with varying levels of specificness, I can't seem to come up with such a file for x86 machines.
   So am I just missing a particular package, or what?
   Apologies if this has already been answered in another thread. I've looked, but may have missed something, since I was distracted by all the steam coming out of my ears...

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
What does it take to compile a ^%$ MFC app?
« Reply #1 on: May 27, 2005, 10:17:18 pm »
Welcome Crazy Eddie :)

I have no problems building windows apps (including RCs) with VCToolkit. All I have is the VCToolkit 2003 free download and the platform SDK (although a bit outdated - August 2002).
From what I 've read in a simple google search I just did, "nafxcw.lib" is part of the Microsoft Foundation Classes (MFC). That's all I can tell you, though, about MFC :oops: ...

Maybe someone else can help you better,
Yiannis.
Be patient!
This bug will be fixed soon...

Offline Crazy_Eddie

  • Single posting newcomer
  • *
  • Posts: 3
What does it take to compile a ^%$ MFC app?
« Reply #2 on: May 27, 2005, 10:37:08 pm »
Hmm... It look like, for some odd reason, the install program is simply refusing to give me the x86 version of MFC... I think maybe I installed wrong versions(with the 64bit code) and it's adamantly sticking to that.
   I wonder what it's going to take to get it to forget the previous crap and give me what I need now?

   Anyway, thanks for the reply.

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
What does it take to compile a ^%$ MFC app?
« Reply #3 on: May 28, 2005, 12:16:14 am »
you can't compile a MFC app with the free VC Toolkit.
the MFC sources and libs are supplied only with the full Visual C compilers
go and get an old Visual studio 6.0 CD set, they are sold at about 20EUR today.
it's really worth this money. or get a student licence for VS2003.NET, it's about the same price.

Offline Crazy_Eddie

  • Single posting newcomer
  • *
  • Posts: 3
What does it take to compile a ^%$ MFC app?
« Reply #4 on: May 29, 2005, 11:05:24 pm »
Would you believe I just happenned upon an old copy of VC++ 6 I had lying around the house? I have it installed, so no I have to mess around with it for a bit. Thanks for the info though.

Offline batagy

  • Single posting newcomer
  • *
  • Posts: 5
What does it take to compile a ^%$ MFC app?
« Reply #5 on: June 23, 2005, 07:54:51 pm »
Hi all,

Firstly I want to say thank you for this really great IDE. It greatly works with the free Visual C++ Toolkit 2003 command line compiler on Windows. Also it is worth to mention that it supports importing MS Visual Studio project files.

Now my question is related with MFC libraries and headers. If I would compile an MFC dependent source with the free Visual C++ Toolkit 2003, would be it possible somehow, or is it totally impossible?

tiwag writes above, that MFC sources and libraries are only supplied with the full Visual Studio. But my question, can those MFC libraries and headers be downloaded somewhere from the internet legally, and simply put them to the inc and libs folders?

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
What does it take to compile a ^%$ MFC app?
« Reply #6 on: June 23, 2005, 08:39:18 pm »
Maybe it's the "Microsoft Platform SDK" you're looking for? I downloaded the latest version. Couldn't install it due to Windows problems  :roll:, so I can't really tell if it includes MFC's. It includes the famous windows.h, however.

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
What does it take to compile a ^%$ MFC app?
« Reply #7 on: June 23, 2005, 09:17:20 pm »
Quote from: batagy
...But my question, can those MFC libraries and headers be downloaded somewhere from the internet legally, and simply put them to the inc and libs folders?

sorry, no they are copyright protected by M$, you get a license if you buy VisualC++,

technically spoken, there are a lot of download possibilities like edonkey and other p2p nets. but it's illegal.

Offline batagy

  • Single posting newcomer
  • *
  • Posts: 5
What does it take to compile a ^%$ MFC app?
« Reply #8 on: June 23, 2005, 09:43:43 pm »
Quote from: rickg22
Maybe it's the "Microsoft Platform SDK" you're looking for? I downloaded the latest version. Couldn't install it due to Windows problems  :roll:, so I can't really tell if it includes MFC's. It includes the famous windows.h, however.

Thanks for the answer, but Microsoft Platfrom SDK and .NET Framework SDK are also installed on my system. Without them the Visual C++ Toolkit 2003 doesn't work. It's sure that they don't contain MFC's by default.
The Platform SDK was installed successfully for me, I downloaded the complete package, and installed locally, not through the internet. I don't know why it doesn't work for you.

Back to MFC. Basically I would compile gammu (www.gammu.net) as a static library. One of the source file contains a reference to afxres.h, which is as far as I know (because I cannot code a single word  :oops: ) is an MFC thing. I found it on internet, that if the source doesn't contain MFC's, in that case afxres.h can be changed to winresrc.h without any problem. So I changed to it to winresrc.h, but in this case the compiling fails, so it seems there are some MFC dependent function.

Offline batagy

  • Single posting newcomer
  • *
  • Posts: 5
What does it take to compile a ^%$ MFC app?
« Reply #9 on: June 23, 2005, 09:50:36 pm »
Quote from: tiwag
Quote from: batagy
...But my question, can those MFC libraries and headers be downloaded somewhere from the internet legally, and simply put them to the inc and libs folders?

sorry, no they are copyright protected by M$, you get a license if you buy VisualC++,

technically spoken, there are a lot of download possibilities like edonkey and other p2p nets. but it's illegal.


Ah. thanks for the answer! In this case I should install a real Visual Studio. I have a 60 day trial version.
Thanks!

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
What does it take to compile a ^%$ MFC app?
« Reply #10 on: June 23, 2005, 10:05:40 pm »
Quote from: batagy
One of the source file contains a reference to afxres.h, which is as far as I know (because I cannot code a single word  :oops: ) is an MFC thing. I found it on internet, that if the source doesn't contain MFC's, in that case afxres.h can be changed to winresrc.h without any problem. So I changed to it to winresrc.h, but in this case the compiling fails, so it seems there are some MFC dependent function.

If there is no other dependency on MFC except afxres.h, try putting windows.h/winresrc.h (depends on the platform).
I had it happen to me once and I actually just comented out "#include <afxres.h>" and some language-specific instructions in the resource file and everything went fine after that.

Yiannis.
Be patient!
This bug will be fixed soon...

Offline batagy

  • Single posting newcomer
  • *
  • Posts: 5
What does it take to compile a ^%$ MFC app?
« Reply #11 on: June 23, 2005, 10:31:35 pm »
Quote from: mandrav
If there is no other dependency on MFC except afxres.h, try putting windows.h/winresrc.h (depends on the platform).
I had it happen to me once and I actually just comented out "#include <afxres.h>" and some language-specific instructions in the resource file and everything went fine after that.

Yiannis.

Thanks.
When I try to compile it in its original form, CodeBlocks only highlights afxres.h. Does this means that afxres.h is the only MFC dependency?

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
What does it take to compile a ^%$ MFC app?
« Reply #12 on: June 24, 2005, 12:10:45 am »
Quote from: batagy
Thanks.
When I try to compile it in its original form, CodeBlocks only highlights afxres.h. Does this means that afxres.h is the only MFC dependency?

I wouldn't know without looking at the log...
Read the build log carefully. It's all there ;)

Yiannis.
Be patient!
This bug will be fixed soon...

Offline batagy

  • Single posting newcomer
  • *
  • Posts: 5
What does it take to compile a ^%$ MFC app?
« Reply #13 on: June 24, 2005, 10:40:22 pm »
Quote from: mandrav
I wouldn't know without looking at the log...
Read the build log carefully. It's all there ;)

Yiannis.

Hi,

When I create a totally empty afxres.h file, and put in one of the headers folder, to following is the log of CodeBlocks:

Project   : gammu
Compiler  : Microsoft Visual C++ Toolkit 2003 (called directly)
Directory : D:\Gammu\gammu\win32\dll\
--------------------------------------------------------------------------------
Switching to target: Release
affix.c
blue_w32.c
bluetoth.c
bluez.c
devfunc.c
irda.c
ser_w32.c
gsmcomon.c
gsmstate.c
cfg.c
coding.c
md5.c
misc.c
alcatel.c
atgen.c
samsung.c
siemens.c
sonyeric.c
dct3func.c
n0650.c
n6110.c
n7110.c
n9210.c
6510cal.c
6510file.c
n6510.c
dct4func.c
n3320.c
n3650.c
nauto.c
nfunc.c
nfuncold.c
obexgen.c
pfunc.c
mroutgen.c
alcabus.c
at.c
fbus2.c
mbus2.c
phonet.c
obex.c
mrouter.c
backics.c
backldif.c
backlmb.c
backtext.c
backvcf.c
backvcs.c
gsmback.c
gsmcal.c
gsmdata.c
gsmlogo.c
gsmmisc.c
gsmnet.c
gsmpbk.c
gsmring.c
gsmems.c
gsmmulti.c
gsmsms.c
gammu.rc (20): error RC2144 : PRIMARY LANGUAGE ID not a number
gammu.rc (56): error RC2135 : file not found: VS_VERSION_INFO
gammu.rc (57): error RC2135 : file not found: 1
gammu.rc (58): error RC2135 : file not found: 1
gammu.rc (59): error RC2135 : file not found: 0x3fL
gammu.rc (65): error RC2135 : file not found: FILEOS
gammu.rc (66): error RC2135 : file not found: 0x2L
gammu.rc (69): error RC2164 : unexpected value in RCDATA
gammu.rc (71): error RC2135 : file not found: BLOCK
gammu.rc (73): error RC2135 : file not found: VALUE
gammu.rc (74): error RC2135 : file not found: VALUE
gammu.rc (75): error RC2135 : file not found: VALUE
Process terminated with status 1 (0 minutes, 41 seconds)
0 errors, 0 warnings
 
----

When I put winresrc.h or windows.h instead of afxres.h in the gammu.rc file, the following occurs:

Project   : gammu
Compiler  : Microsoft Visual C++ Toolkit 2003 (called directly)
Directory : D:\Gammu\gammu\win32\dll\
--------------------------------------------------------------------------------
Switching to target: Release
affix.c
blue_w32.c
bluetoth.c
bluez.c
devfunc.c
irda.c
ser_w32.c
gsmcomon.c
gsmstate.c
cfg.c
coding.c
md5.c
misc.c
alcatel.c
atgen.c
samsung.c
siemens.c
sonyeric.c
dct3func.c
n0650.c
n6110.c
n7110.c
n9210.c
6510cal.c
6510file.c
n6510.c
dct4func.c
n3320.c
n3650.c
nauto.c
nfunc.c
nfuncold.c
obexgen.c
pfunc.c
mroutgen.c
alcabus.c
at.c
fbus2.c
mbus2.c
phonet.c
obex.c
mrouter.c
backics.c
backldif.c
backlmb.c
backtext.c
backvcf.c
backvcs.c
gsmback.c
gsmcal.c
gsmdata.c
gsmlogo.c
gsmmisc.c
gsmnet.c
gsmpbk.c
gsmring.c
gsmems.c
gsmmulti.c
gsmsms.c
gammu.c
Linking dynamic library: .\Release\gammu.dll
ser_w32.obj : error LNK2019: unresolved external symbol __imp__RegCloseKey@4 referenced in function _serial_open
ser_w32.obj : error LNK2019: unresolved external symbol __imp__RegEnumValueA@32 referenced in function _serial_open
ser_w32.obj : error LNK2019: unresolved external symbol __imp__RegOpenKeyExA@20 referenced in function _serial_open
.\Release\gammu.dll : fatal error LNK1120: 3 unresolved externals
Process terminated with status 1 (0 minutes, 37 seconds)
4 errors, 0 warnings
 
Now what's your opinion about this? I cannot do programming, so I don't know what it does mean.

Thanks

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
What does it take to compile a ^%$ MFC app?
« Reply #14 on: June 24, 2005, 11:56:46 pm »
Quote
Linking dynamic library: .\Release\gammu.dll
ser_w32.obj : error LNK2019: unresolved external symbol __imp__RegCloseKey@4 referenced in function _serial_open
ser_w32.obj : error LNK2019: unresolved external symbol __imp__RegEnumValueA@32 referenced in function _serial_open
ser_w32.obj : error LNK2019: unresolved external symbol __imp__RegOpenKeyExA@20 referenced in function _serial_open
.\Release\gammu.dll : fatal error LNK1120: 3 unresolved externals
Process terminated with status 1 (0 minutes, 37 seconds)
4 errors, 0 warnings

Now what's your opinion about this? I cannot do programming, so I don't know what it does mean.

This indicates that the resource files were built. The linking failed.
Try adding advapi32.lib in your linker libraries. It should take care of the problem.

Yiannis.
Be patient!
This bug will be fixed soon...

Offline Muffin

  • Single posting newcomer
  • *
  • Posts: 5
Re: What does it take to compile a ^%$ MFC app?
« Reply #15 on: November 05, 2005, 09:00:50 pm »
When I put winresrc.h or windows.h instead of afxres.h in the gammu.rc file, the following occurs:

Try changing #include "afxres.h" to #include "mfc/afxres.h". This is where the windows file search locates "afxres.h".

sethjackson

  • Guest
Re: What does it take to compile a ^%$ MFC app?
« Reply #16 on: November 05, 2005, 10:19:33 pm »