[CMake] CMake & MFC

Robert Dailey rcdailey at gmail.com
Thu Oct 20 20:12:09 EDT 2011


I think I found the issue.

Deep inside one of the Microsoft Exchange LIB files that I link against my
MFC project executable is the following (I copied this out of the text
editor):

-defaultlib:mfc40.lib -defaultlib:mfcs40.lib -defaultlib:msvcrt.lib
-defaultlib:kernel32.lib -defaultlib:user32.lib -defaultlib:gdi32.lib
-defaultlib:comdlg32.lib -defaultlib:winspool.lib -defaultlib:advapi32.lib
-defaultlib:shell32.lib -defaultlib:comctl32.lib /include:__afxForceEXCLUDE
/include:__afxForceUSRDLL /include:__afxForceSTDAFX -defaultlib:LIBC
-defaultlib:OLDNAMES


I don't know what the dash "-" means, but looks like maybe it is pulling
that lib out from this lib? I don't know how that works but it's very
sneaky... any idea what these command-line arguments are doing in a debug
LIB file???

---------
Robert Dailey


On Thu, Oct 20, 2011 at 6:52 PM, Robert Dailey <rcdailey at gmail.com> wrote:

> More updates.
>
> I generated my MFC project as normal through CMake and still have the
> mfc40.lib can't be found linker error. So what I did was remove 1 CPP file
> from the project at a time, clean, rebuild and see what different results I
> get. Well, once all of the MFC related CPP files (the app class, dialog
> classes, etc) were removed, the remaining CPP files linked gave me this:
>
> LNK1104: cannot open file 'libc.lib'
>
> Now this is just confusing. What is this lib and why can't it find it?
>
> ---------
> Robert Dailey
>
>
>
> On Thu, Oct 20, 2011 at 3:38 PM, Robert Dailey <rcdailey at gmail.com> wrote:
>
>> Those quotes do look suspicious but for some reason they work just fine in
>> Cygwin.
>>
>> Basically I load vsvars32.bat into my cygwin environment, and I have
>> modified the paths in that batch file to the "short path" format since our
>> makefile build scripts do not play friendly with spaces in the file paths.
>> Don't ask me much more about it, I didn't write the scripts so I'm not very
>> familiar with them.
>>
>> No MFC4 libs are in my Visual Studio installation directory. Also there
>> are NO mfc4 libs anywhere on my entire hard drive, as I did a search at that
>> level as well.
>>
>> What about the command switches? There are quite a few of them and I don't
>> know what most of them do. Did you find anything related to this problem
>> that CMake might be missing? One thing I've been trying to figure out is
>> exactly how mfc40.lib is coming up. It's not in the command line, I haven't
>> found it in the source code, so where the heck would it be coming from? I'm
>> completely at a loss. Would _WIN_VER=0x400 (or whatever version) or
>> something have anything to do with this?
>>
>>
>> On Thu, Oct 20, 2011 at 2:20 PM, David Cole <david.cole at kitware.com>wrote:
>>
>>> The quote placement look suspicious. Where are these coming from? Do
>>> you have quotes embedded in environment variable values?
>>>
>>> -I"C:/PROGRA~1/MICROS~1.NET/Vc7"/include
>>> -I"C:/PROGRA~1/MICROS~1.NET"/VC7/PlatformSDK/include
>>> -I"C:/PROGRA~1/MICROS~1.NET/Vc7"/atlmfc/include
>>> -I"C:/PROGRA~1/MICROS~1.NET/Vc7"/atlmfc/include
>>>
>>> /LIBPATH:"C:/PROGRA~1/MICROS~1.NET/Vc7"/atlmfc/lib
>>>
>>> And is the mfc4 lib that it's looking for actually in the "atlmfc/lib"
>>> folder of your Visual Studio installation?
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111020/da7261c1/attachment.htm>


More information about the CMake mailing list