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.

  • Resolved

Fatal error: could not open source file "sys/time.h"

Prodigy 80 points

Replies: 4

Views: 12644

Hello,

I am completely new to the CCS, please accept my apologies for possibly simple questions.

I have to profile a codec (in .cpp) in terms of latency for a CPU. I am not sure if I am in the correct path, but I have created a new CCS project, and created the folders and files corresponding to the codec. I have chosen C6000 family, Generic C64x+ Device, and rts64plus.lib as the general configurations. But I am completely uncertain about all of  the settings. 

I have also created a .ccxml file in which the connection is Texas Instruments Simulator with C64x+ CPU Cycle Accurate Simulator, Little Endian as the device.

When I try to build the application, I encounter an error: 

fatal error #5: could not open source file "sys/time.h"

Do I have to choose another compiler? What are the best settings to keep the codec running?

Please let me know if I have to provide more information.

Thank you in advance.

  • Guru 122865 points

    Do you have a line in your code something like #include "sys/time.h"?  If so you will want to edit the include paths for your project.  Basically the compiler needs to know where to look for this file.  In your case it is already if the file is in C:\stuff\stuff\stuff\sys\time.h then you would want to setup the include path as C:\stuff\stuff\stuff as you already have \sys in your #include statement.

    You can edit your include paths by right clicking on your project.  Select Properties.  Under CCS Build you should see C6000 compiler.  Expand that and look for the Include Options group.  Click on it and then on the right hand side you will be able to setup the include paths

    Regards,

    John

     


    If my reply answers your question please click the "This resolved my issue" button

  • In reply to JohnS:

    Hello John,

    I really appreciate your help.
    Actually I have found two versions of "time.h", one in "C:/ti/ccsv5/tools/compiler/c6000/include", and the other one in 

    "C:/cygwin/usr/include".

    I got the impression that the required "time.h" file, is the second one (located in "C:/cygwin/usr/include"), 

    but I am not certain though.

    So, I tried these settings:
    1. I added "C:/cygwin/usr/include", in the Include Options for C6000 compiler, just as you told me.
    But I encountered some compilation errors, such as:

    "C:/cygwin/usr/include/sys/_types.h", line 36: error #78-D: this declaration has no storage class 
    or type specifier
    "C:/cygwin/usr/include/sys/_types.h", line 36: error #66: expected a ";"
    "C:/cygwin/usr/include/sys/types.h", line 116: error #268: "time_t" is ambiguous
    "C:/cygwin/usr/include/sys/time.h", line 18: error #268: "time_t" is ambiguous
    "C:/cygwin/usr/include/sys/time.h", line 38: error #268: "timeval" is ambiguous
    "C:/cygwin/usr/include/sys/time.h", line 39: error #268: "timeval" is ambiguous
    "C:/cygwin/usr/include/sys/time.h", line 74: error #268: "timeval" is ambiguous
    "C:/cygwin/usr/include/sys/time.h", line 75: error #268: "timeval" is ambiguous
    "C:/cygwin/usr/include/sys/time.h", line 76: error #268: "timeval" is ambiguous
    "..\XFramework\XUtilities\..\..\Project\..\Tools\HRTimer.h", line 53: error #268: "timeval"
    is ambiguous
    "..\XFramework\XUtilities\..\..\Project\..\Tools\HRTimer.h", line 54: error #268: "timeval"
    is ambiguous

    2. Then I removed "C:/cygwin/usr/include" from the Include Options, and decided to make a new folder named "sys" 

    in this path: "C:/ti/ccsv5/tools/compiler/c6000/include", and copied "time.h" from "C:/cygwin/usr/include" to this 

    new folder.

    This is the error in this case:
    "C:/ti/ccsv5/tools/compiler/c6000/include/sys/time.h", line 8: fatal error #5: could not open source file "_ansi.h"
    And I can't find this "_ansi.h" file anywhere!

    I would be so grateful if you could guide me to resolve these errors.

    Best regards

  • Guru 122865 points

    In reply to PoB:

    Are you including cygwin in your application?  If not then the time.h file you need is the one in C:/ti/ccsv5/tools/compiler/c6000/include

    Can you show the full error code that says "fatal error #5: could not open source file "sys/time.h"  It should have a source file associated with it. 

    john


     


    If my reply answers your question please click the "This resolved my issue" button

  • In reply to JohnS:

    Since I'm just using this codec (it has been developed by other people), I am not sure whether I have to include 
    cygwin or not. 
    • This is the full error code:
    **** Build of configuration Debug for project Temp ****
    C:\ti\ccsv5\utils\bin\gmake -k all 
    'Invoking: C6000 Compiler'
    "C:/ti/ccsv5/tools/compiler/c6000/bin/cl6x" -mv64+ -g --program_level_compile --exceptions
    --include_path="C:/ti/ccsv5/tools/compiler/c6000/include"
    --include_path="C:/Program Files/C6xCSL/include" --display_error_number
    --diag_warning=225 --abi=coffabi "../XFramework/XUtilities/XBinaryNumber.cpp"
    "../XFramework/XUtilities/XException.cpp" "../XFramework/XMath/XVec3.cpp"
    "../XFramework/XDatastructures/XNode.cpp" "../XFramework/XDatastructures/XTree.cpp"
    "../Tools/HRTimer.cpp" "../Tools/UsefulFunctions.cpp" "../Quantizer/AbsQuantizer.cpp"
    "../Quantizer/DeadzoneQuantizer.cpp" "../Quantizer/UniformQuantizer.cpp" "../Project/main.cpp"
    "../Project/stdafx.cpp" "../FileReader/FileReader.cpp"
    "../FOP/FOPWavTransformer/FOPWavTransformer.cpp" "../FOP/FOPMesh/FOPMesh.cpp"
    "../FOP/FOPMesh/FOPPolygon.cpp" "../FOP/FOPMesh/FOPVertex.cpp"
    "../FOP/FOPEncoder/FOPBitplaneCoder.cpp" "../FOP/FOPEncoder/FOPEncoder.cpp"
    "../FOP/FOPDecoder/FOPBitplaneDecoder.cpp" "../FOP/FOPDecoder/FOPDecoder.cpp"
    "../FOP/FOPDataStructures/FOPNode.cpp" "../FOP/FOPDataStructures/FOPTree.cpp"
    "../FOP/FOPDataStructures/FOPWavelet.cpp" "../ArithmeticCodec/arithmetic_codec.cpp"
    [XBinaryNumber.cpp]
    "..\XFramework\XUtilities\..\..\Project\..\Tools\HRTimer.h", line 23: fatal error #5: could not
    open source file "sys/time.h"
    1 fatal error detected in the compilation of "../XFramework/XUtilities/XBinaryNumber.cpp".
    Compilation terminated.

    >> Compilation failure
    gmake: *** [HRTimer.obj] Error 1
    gmake: Target `all' not remade because of errors.

    **** Build Finished ****
    • And this is "HRTimer.h" which tries to call "time.h":
    #pragma once

    //////////////////////////////////////////////////////////////////////////////
    // Timer.h
    // =======
    // High Resolution Timer.
    // This timer is able to measure the elapsed time with 1 micro-second accuracy
    // in both Windows, Linux and Unix system
    //
    // AUTHOR: Song Ho Ahn (song.ahn@gmail.com)
    // CREATED: 2003-01-13
    // UPDATED: 2006-01-13
    //
    // Copyright (c) 2003 Song Ho Ahn
    //////////////////////////////////////////////////////////////////////////////

    #ifndef TIMER_H_DEF
    #define TIMER_H_DEF

    #ifdef WIN32 // Windows system specific
    #include <windows.h>
    #else // Unix based system specific
    #include <sys/time.h>
    #endif

    class HRTimer
    {
    public:
    HRTimer(); // default constructor
    ~HRTimer(); // default destructor

    void start(); // start timer
    void stop(); // stop the timer
    double getElapsedTime(); // get elapsed time in second
    double getElapsedTimeInSec(); // get elapsed time in second (same as getElapsedTime)
    double getElapsedTimeInMilliSec(); // get elapsed time in milli-second
    double getElapsedTimeInMicroSec(); // get elapsed time in micro-second

    protected:

    private:
    double startTimeInMicroSec; // starting time in micro-second
    double endTimeInMicroSec; // ending time in micro-second
    int stopped; // stop flag
    #ifdef WIN32
    LARGE_INTEGER frequency; // ticks per second
    LARGE_INTEGER startCount; //
    LARGE_INTEGER endCount; //
    #else
    timeval startCount; //
    timeval endCount; //
    #endif
    };

    #endif // TIMER_H_DEF

    Please let me know if I have to provide more information.

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.