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.

简单问题,很多例程里主函数文件没有声明外部函数就可以直接调用其他文件的函数,我这么做rebuild all时就报错,这个是怎么设置的?

Other Parts Discussed in Thread: CCSTUDIO

例程里就顺利通过了.

  • 通过主程序include进来的头文件就可以找到相应外设的头文件,就可以找到申明代码了。

    注意头文件的搜索路径。

  • 我和他的include都是一样的

    #include "DSP2833x_Device.h" // DSP2833x Headerfile Include File
    #include "DSP2833x_Examples.h" // DSP2833x Examples Include File

    我还专门看了他的头文件 里面并没有函数声明.

  • 举个例子:

    DSP2833x_examples\adc_dma\Example_2833xAdcToDMA.pjt

    打开这个project后,他的主程序文件Example_2833xAdcToDMA.c里面的include

    #include "DSP2833x_Device.h" // Headerfile Include File
    #include "DSP2833x_Examples.h" // Examples Include File

    查看build otpiong -> compiler -> Preprocessor -> Include search path 

    ..\..\DSP2833x_headers\include;..\..\DSP2833x_common\include

    我找到这两个目录下的

    C:\CCStudio_v3.3\MyProjects\v101\DSP2833x_common\include\DSP2833x_Examples.h

    C:\CCStudio_v3.3\MyProjects\v101\DSP2833x_headers\include\DSP2833x_Device.h

    还看了头文件

    C:\CCStudio_v3.3\MyProjects\v101\DSP2833x_headers\include\DSP2833x_DMA.h

    在这里面都没找到有函数声明的语句.

    但是这个主程序在没有外部声明的前提下有如下语句

    DMACH1AddrConfig(DMADest,DMASource);
    DMACH1BurstConfig(15,1,10);
    DMACH1TransferConfig(9,0,1);
    DMACH1WrapConfig(1,0,0,1);
    DMACH1ModeConfig(DMA_SEQ1INT,PERINT_ENABLE,ONESHOT_DISABLE,CONT_DISABLE,SYNC_DISABLE,SYNC_SRC,
    OVRFLOW_DISABLE,SIXTEEN_BIT,CHINT_END,CHINT_ENABLE);

    而且能通过编译,所以我才觉得奇怪

  • 不会的,凡使用定要声明的,你说的这个声明在DSP2833x_GlobalPrototypes中,而DSP2833x_GlobalPrototypes又在DSP2833x_Examples中包含

  • 果然在这里面,谢谢.