VisualGDB use g++ when linking C program

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

Viewing 4 posts - 1 through 4 (of 4 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.

    #36277
    AnthonyF
    Participant

    Thanks for your quick answer.
    Where exactly in my project can I redine those values ?

    #36284
    support
    Keymaster

    Hi,

    Please refer to the MSBuild documentation on custom targets and properties. This is not specific to VisualGDB and we would advise getting familiar with the topic before doing any low-level customizations.

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