#253 Solution task doesn't do MFC shared apps.

0.85
closed-fixed
Tasks (408)
5
2004-12-08
2004-12-03
Hani Atassi
No

I found out that the <solution> task doesn't compile the
MFC application correctly.

Basically, it's not adding the compiler
switch /D "_AFXDLL" or the necessary switches for MFC
configuration when compiling.

I will try to come up with a fix soon, if no one has a fix
for this.

To Reproduce:
- Create any MFC solution using Visual Studio.NET
- Create a simple NAnt build file containg something like
the following:
<target name="build">
<solution configuration="Debug"
solutionfile="NAntMFCTest.sln" />
</target>
- Run NAnt on the script..

You would get the following errors:
1- It won't compile the resource files. This is fixed by a
previous bug (ID: 1077712)
2- The link will fail because of unresolved external
symbols.

Discussion

  • Hani Atassi

    Hani Atassi - 2004-12-03
    • summary: Solution task doesn't do MFC apps. --> Solution task doesn't do MFC shared apps.
     
  • Hani Atassi

    Hani Atassi - 2004-12-06

    Logged In: YES
    user_id=590187

    DESCRIPTION: NAnt.VSNet.VcConfiguration doesn't read the
    attribute values UseOfMFC and UseOfATL from the project file.

    RESOLUTION: My proposed solution is the following:
    1- Add new types in the namespace (NAnt.VisualCpp.Types)
    call them UseOfATL and UseOfMFC
    2- Read these type inside VcConfiguration constructor
    3- Use the type when compiling files to add the definition /D
    _AFXDLL or /D _ATL_DLL

    I attached a file with the proposed changes.. Hope this helps..

     
  • Hani Atassi

    Hani Atassi - 2004-12-06

    Fixes for MFC and ATL shared Apps

     
  • Gert Driesen

    Gert Driesen - 2004-12-06

    Logged In: YES
    user_id=707851

    Hani, can you also attach a small test solution to this bug
    report ?

    For now, I'll probably add the enums to the
    NAnt.VSNet.Types namespace.

     
  • Hani Atassi

    Hani Atassi - 2004-12-06

    Contains test solutions for this bug (MFC and ATL).

     
  • Hani Atassi

    Hani Atassi - 2004-12-06

    Logged In: YES
    user_id=590187

    Attach is two solutions: One is an MFC dialog based
    solution that is dynamically linked with MFC. Without
    defining _AFXDLL, you will get bunch of linker errors. The
    other solution is an ATL dll that is linked dynamically
    with ATL. Also, without defining _ATL_DLL you would get
    bunch of linker errors.

    I also noticed that Visual Studio adds the defintion
    _ATL_STATIC_REGISTRY in case of ATL static linking. So,
    you probably need to add the following code to my fix
    after testing shared ATL:
    } else if (baseConfig.UseOfATL ==
    NAnt.VisualCpp.Types.UseOfATL.Static) {
    clTask.Arguments.Add(new Argument("/D"));
    clTask.Arguments.Add(new Argument
    ("_ATL_STATIC_REGISTRY"));
    }

    Hope this helps...

     
  • Hani Atassi

    Hani Atassi - 2004-12-06

    Contains test solutions for this bug (MFC and ATL).

     
  • Hani Atassi

    Hani Atassi - 2004-12-06

    Logged In: YES
    user_id=590187

    Attach is two solutions: One is an MFC dialog based
    solution that is dynamically linked with MFC. Without
    defining _AFXDLL, you will get bunch of linker errors. The
    other solution is an ATL dll that is linked dynamically
    with ATL. Also, without defining _ATL_DLL you would get
    bunch of linker errors.

    I also noticed that Visual Studio adds the defintion
    _ATL_STATIC_REGISTRY in case of ATL static linking. So,
    you probably need to add the following code to my fix
    after testing shared ATL:
    } else if (baseConfig.UseOfATL ==
    NAnt.VisualCpp.Types.UseOfATL.Static) {
    clTask.Arguments.Add(new Argument("/D"));
    clTask.Arguments.Add(new Argument
    ("_ATL_STATIC_REGISTRY"));
    }

    Hope this helps...

     
  • Gert Driesen

    Gert Driesen - 2004-12-08
    • assigned_to: nobody --> drieseng
    • status: open --> closed-fixed
     
  • Gert Driesen

    Gert Driesen - 2004-12-08

    Logged In: YES
    user_id=707851

    Your patch has now been committed to cvs, with minor
    modifications.

    Thanks a lot !!!

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks