CCS3.3:error: symbol referencing errors - './Debug/*.out' not built

来源:互联网 发布:magic launcher 知乎 编辑:程序博客网 时间:2024/04/30 02:34
 

转载:CCS v3.3开发环境Step by step

CCS v3.3开发环境 Step by step (1)

Step 1: 创建一个工程,同时增加一个c文件,消除所有的编译、链接错误和警告。

1、创建一个项目工程:
通过菜单:Project>New, 然后在Project Creation对话框中输入:
Project Name: hello
Location: C:\test\hello\
Project Type: Executable (.out)
Target: TMS320C55XX
点击Finish完成工程创建。
这时在C:\test\hello\ 目录下得到二个基本的文件:
hello.pjt - 工程文件
hello.sbl

hello.pjt文件的内容如下:
; Code Composer Project File, Version 2.0 (do not modify or remove this line)
=》文件头,用于CCS识别文件版本等信息,注意不能被手工修改!!!
[Project Settings] =》 项目信息
ProjectDir="C:\test\hello\" =》指向项目文件的绝对路径。而项目文件中的相对路径都是基于该路径而然
ProjectType=Executable =》项目类型,指项目工程用于生成一个可执行的文件还是库文件
CPUFamily=TMS320C55XX =》 CPU家族
Tool="Compiler"
Tool="CustomBuilder"
Tool="DspBiosBuilder"
Tool="Linker"
Config="Debug"
Config="Release"

["Compiler" Settings: "Debug"] =》 编译器选项
Options=-g -fr"$(Proj_dir)\Debug" -d"_DEBUG"

["Compiler" Settings: "Release"]
Options=-o2 -fr"$(Proj_dir)\Release"

["Linker" Settings: "Debug"] =》 链接器选项
Options=-c -m".\Debug\hello.map" -o".\Debug\hello.out" -w -x

["Linker" Settings: "Release"]
Options=-c -m".\Release\hello.map" -o".\Release\hello.out" -w -x

2、增加文件
鼠标右键,点击“Add Files to Project...”,增加一个hello.c文件到项目工程中
hello.c文件内容如下:
#include <stdio.h>

void main(void)
{
printf("Hello word!\n");
}

3、编译、修改错误
编译得到错误信息如下(这些也可以直接从文件cc_build_Debug.log中得到):
----------------------------- hello.pjt - Debug -----------------------------
[hello.c] "C:\CCStudio_v3.3\C5500\cgtools\bin\cl55" -g -fr"C:/test/hello/Debug" -d"_DEBUG" -@"Debug.lkf" "hello.c"

Warning: The project has no cmd file while the Text Linker is selected
[Linking...] "C:\CCStudio_v3.3\C5500\cgtools\bin\cl55" -@"Debug.lkf"
<Linking>
>> warning: creating output section .const without SECTIONS specification
>> warning: entry point symbol _c_int00 undefined

undefined first referenced
symbol in file
--------- ----------------
_printf C:\\test\\hello\\Debug\\hello.obj
>> error: symbol referencing errors - './Debug/hello.out' not built

>> Compilation failure

Build Complete,
2 Errors, 4 Warnings, 0 Remarks.

这是没有为工程指定选用具体的rts库文件所致;两种方法可以用来进行修正,
方案一、直接将所需要的库文件加到项目工程中,譬如:鼠标右键,点击“Add Files to Project...”,选中:C:\CCStudio_v3.3\C5500\cgtools\lib\rts2800.lib;
方案二、修改链接器的链接参数即可;譬如:鼠标右键,点击“Build Options...”,选Linker Tab, Category中选Libraries, 设置Inc. Libraries (-l): 为 rts2800.lib;

一般来说,方案二为推荐使用,便于项目工程文件的移动、拷贝,特别组内多人开发使用!!

重新编译,其结果如下:
----------------------------- hello.pjt - Debug -----------------------------
[hello.c] "C:\CCStudio_v3.3\C5500\cgtools\bin\cl55" -g -fr"C:/test/hello/Debug" -d"_DEBUG" -@"Debug.lkf" "hello.c"

Warning: The project has no cmd file while the Text Linker is selected
[Linking...] "C:\CCStudio_v3.3\C5500\cgtools\bin\cl55" -@"Debug.lkf"
<Linking>
>> warning: creating output section vectors without SECTIONS specification
>> warning: creating output section .const without SECTIONS specification
>> warning: creating output section .cio without SECTIONS specification
>> warning: creating .stack section with default size of 500 words.
Use
-stack option to change the default size.
>> warning: creating .sysstack section with default size of 500 words.
Use
-sysstack option to change the default size.
>> warning: creating .sysmem section with default size of 1000 words.
Use
-heap option to change the default size.

Build Complete,
0 Errors, 7 Warnings, 0 Remarks.

Ok, 成功,消除了所有的编译错误,但还是有一些Warning;怎么办?
呵呵,咱们接着看

4、消除编译警告
增加一个.cmd 配置文件
将C:\CCStudio_v3.3\C5500\cgtools\lib\lnk.cmd 文件拷贝到c:\test\hello\hello.cmd
同时将hello.cmd文件加入到项目工程当中即可。
----------------------------- hello.pjt - Debug -----------------------------
[hello.c] "C:\CCStudio_v3.3\C5500\cgtools\bin\cl55" -g -fr"C:/test/hello/Debug" -d"_DEBUG" -@"Debug.lkf" "hello.c"

[Linking...] "C:\CCStudio_v3.3\C5500\cgtools\bin\cl55" -@"Debug.lkf"
<Linking>

Build Complete,
0 Errors, 0 Warnings, 0 Remarks.

非常幸运,搞定一个基本的工程以及所有相关的编译错误和告警。

5、小结
这些文件需要做备份、保留:
hello.pjt
hello.cmd
hello.c

另外还有临时文件:
hello.sbl => 动态生成的二进制项目工程
Debug.lkf => 链接器选项参数
cc_build_Debug.log => 编译链接的Log文件
临时目录:
Debug => 生成的输出文件和临时Object file.
hello.CS_