Resolving file relative path based on solution platform( win32 or x64)

Unanswered Resolving file relative path based on solution platform( win32 or x64)

  • Tuesday, August 14, 2012 8:47 AM
     
     
    I am using MS Visual Studio 2008 / VC++. MIDL tool generates two types of different files(e.g. *_c.c, *_s.c and *.h)
    for x86 and x64 version compatible.
    Based on my solution platform, I want to compile the corresponding MIDL generated .c file.
    But, in .vcproj, we have to mention File's Relative Path for
    compilation. How we can mention separate file path based on solution platform in .vcproj file or is there any other way to do?
    We tried by using "$(PlatformName)" in Relative File Path, but "$(PlatformName)" is not getting resolved.
    Please Help.

All Replies

  • Thursday, August 16, 2012 2:36 AM
     
     

    Hi Gauravkrs,

    I move your thread to MSBuild forum, that would be a better place to submit your question and ask for a hand. Thanks for understanding.

    Regards,

    Damon


    Damon Zheng [MSFT]
    MSDN Community Support | Feedback to us

  • Thursday, August 16, 2012 8:31 AM
     
     

    If we set the Relative File Path variable to the appropriate relative path snippet, will it solved?

    What was error message reported when complied?

  • Thursday, August 16, 2012 8:55 AM
     
     

    Thanks for your reply.

    If we set the actual relative path like,

    RelativePath="..\CTest\Win32\abc_c.c" it works.

    But, if we put path like

    RelativePath="..\CTest\$(PlatformName)\abc_c.c" , it fails.

    Please find the build log

    Compiling...
    abc_c.c
    c1 : fatal error C1083: Cannot open source file: '..\CTest\$(PlatformName)\abc_c.c': No such file or directory

    Please let me know if you need any more details.

    Regards,

    Gaurav

  • Tuesday, August 21, 2012 9:19 AM
     
     

    Are you sure that you set the PlatformName a value?

    We can set it as:

      <PropertyGroup>
        <PlatformName>Win32</PlatformName>
      </PropertyGroup>

    Will it work now?

  • Wednesday, August 22, 2012 10:17 AM
     
     

    Thanks for your reply.

    We are using VS2008. Using Property Manager -> PropertySheet option in Visual Studio we created user macro for PlatformName.

    <?xml version="1.0" encoding="shift_jis"?>
    <VisualStudioPropertySheet
     ProjectType="Visual C++"
     Version="8.00"
     Name="IDLSHEET"
     >
     <Tool
      Name="VCCLCompilerTool"
      AdditionalIncludeDirectories=""
     />
     <UserMacro
      Name="IDLWIN32"
      Value="$(PlatformName)"
     />
    </VisualStudioPropertySheet>

    Since it is a macro, it is preprocessed and keeps the same value for different platforms while building diffrent builds like x64,win32. And this creates issue.

    It seems <PropertyGroup> is used in VS2012. Please suggest.