VisualGDB use g++ when linking C program

Sysprogs forums Forums VisualGDB VisualGDB use g++ when linking C program

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #36275
    AnthonyF
    Participant

    Hello,

    I have created an Embedded Project using MSBuild and a custom toolchain (GNU toolchain rebuild for RISC-V).
    Its call gcc to compile the C file but always g++ for the link.
    This fail to link as g++ want libstdc++ and we do not have it.
    How I can do to make it use gcc and not g++ for the link.

    Thanks
    Anthony

    #36276
    support
    Keymaster

    Hi,

    The rules for invoking the linker for the MSBuild projects are stored in the %VISUALGDB_DIR%\MSBuild\Targets\link.targets file:

    <PropertyGroup Condition="'$(GCCBinaryNameForLinking)' == ''">
      <GCCBinaryNameForLinking>$(GCCBinaryName)</GCCBinaryNameForLinking>
    </PropertyGroup>
    <PropertyGroup Condition="'$(GXXBinaryNameForLinking)' == ''">
      <GXXBinaryNameForLinking>$(GXXBinaryName)</GXXBinaryNameForLinking>
    </PropertyGroup>
    
    <GCCLink 
      Sources="@(Link)" 
      CC="$(GCCBinaryNameForLinking)"
      CXX="$(GXXBinaryNameForLinking)"
      ...
    >

    Hence, you can redefine the GCCBinaryNameForLinking and GXXBinaryNameForLinking to arbitrary values in a PropertyGroup inside your project, and it will replace the default values.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.