This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler: Linkage issues comes after "Treat C files as C++ files" option was marked.

Other Parts Discussed in Thread: CODECOMPOSER

Tool/software: TI C/C++ Compiler

Dear support,

We have a project running on concertoM3:F28M35H52C1 device that includes both C and CPP files.

For some reasons I had to #include some header files (.h) with cpp code to one of our C files. 

After that I had to mark the "Treat C files as C++ files" checkbox in the project properties (CodeComposer version 5.5.0) to be able to successfully compile the updated sources.

The compilation succeed, but now I have linkage issues like that: (WatchDogTask is one of our threads running there)

<Linking>
warning #10229-D: output section ".data" refers to load symbol "WatchDogTask" and hence cannot be compressed; compression "rle" is ignored

undefined first referenced 

symbol in file
--------- ----------------
EMAC_config C:\ti\mcusdk_1_00_00_68\packages\ti\drivers\lib\instrumented\emac_mware.aem3<EMAC.oem3>
.

.

error #10234-D: unresolved symbols remain
error #10010: errors encountered during linking; "L-Full_M3-1.out" not built

Please advise.

Alex.

  • Ignore the warning for now.  Focus on the error regarding the symbol EMAC_config.

    Based on the name, I presume this is a function, and not a variable.  This function must be implemented in a source file that is somehow considered C++ code.  Probably because of ...

    Alex Lifshitz said:
    I had to mark the "Treat C files as C++ files" checkbox in the project properties

    All functions in C++ get their name mangled in the assembly output, in order to support function overloading.  To defeat this mangling, you have to apply extern "C" to the declaration of the function.  For further details, please see this FAQ (not from TI).

    Thanks and regards,

    -George

  • Hi George,

    It's not a function. Here is what I see in M3_ethernet.c file:

    const EMAC_Config EMAC_config =
    {TMDXDOCKH52C1_EMACCOUNT, emacObjects, emacHWAttrs};

    but I still applied the extern "C", and looks like it helped.

    Thanks.

  • I'm glad you solved your problem.  That said, I don't understand why extern "C" helped in this particular instance.

    Thanks and regards,

    -George