Menu

weired linking errors

2007-08-07
2012-09-26
  • Nobody/Anonymous

    Hi all,
    i'm attempting to compile a library in dev and i keep getting these errors that the .c file can't get the .h file for the functions prototypes. i swear the path is correct and i'm just wondering if anyone could maybe tell me what could still cause this. i've pasted the compile log. i'm thinking it has to do with me first before i bother the project page.
    thank you very much
    bits

    Compiler: Default compiler
    Building Makefile: "C:\David Gale\Code\Projects\X3\Dependants\srtp\build\Makefile.win"
    Executing make clean
    rm -f ../srtp/ekt.o ../srtp/srtp.o libsrtp.a

    gcc.exe -c ../srtp/ekt.c -o ../srtp/ekt.o -I"C:/Dev-Cpp/include"

    In file included from ../srtp/ekt.c:48:
    C:/Dev-Cpp/include/srtp\include\ekt.h:78: error: syntax error before "ekt"
    C:/Dev-Cpp/include/srtp\include\ekt.h:125: error: syntax error before '*' token
    C:/Dev-Cpp/include/srtp\include\ekt.h:128: error: syntax error before "e"
    C:/Dev-Cpp/include/srtp\include\ekt.h:134: error: syntax error before "e"
    C:/Dev-Cpp/include/srtp\include\ekt.h:145: error: syntax error before "ekt"
    ../srtp/ekt.c:75: error: syntax error before "ekt"
    ../srtp/ekt.c: In function ekt_octets_after_base_tag': ../srtp/ekt.c:80: error:ekt' undeclared (first use in this function)
    ../srtp/ekt.c:80: error: (Each undeclared identifier is reported only once

    ../srtp/ekt.c:80: error: for each function it appears in.)
    ../srtp/ekt.c: In function `srtcp_packet_get_ekt_spi':
    ../srtp/ekt.c:97: warning: assignment discards qualifiers from pointer target type

    ../srtp/ekt.c: In function srtcp_packet_get_ekt_roc': ../srtp/ekt.c:106: warning: assignment discards qualifiers from pointer target type ../srtp/ekt.c: In functionsrtcp_packet_get_emk_location':
    ../srtp/ekt.c:116: warning: assignment discards qualifiers from pointer target type
    ../srtp/ekt.c: At top level:

    ../srtp/ekt.c:123: error: syntax error before '*' token
    ../srtp/ekt.c: In function ekt_alloc': ../srtp/ekt.c:129: error:policy' undeclared (first use in this function)
    ../srtp/ekt.c:130: error: stream_data' undeclared (first use in this function) ../srtp/ekt.c: At top level: ../srtp/ekt.c:138: error: syntax error before "stream_data" ../srtp/ekt.c: In functionekt_stream_init_from_policy':
    ../srtp/ekt.c:139: error: `stream_data' undeclared (first use in this function)

    ../srtp/ekt.c: In function srtp_stream_init_from_ekt': ../srtp/ekt.c:172: error: structure has no member namedekt'
    ../srtp/ekt.c:176: error: structure has no member named ekt' ../srtp/ekt.c:182: error: structure has no member namedekt'
    ../srtp/ekt.c: At top level:
    ../srtp/ekt.c:196: error: syntax error before "ekt"
    ../srtp/ekt.c: In function ekt_write_data': ../srtp/ekt.c:207: error:ekt' undeclared (first use in this function)

    ../srtp/ekt.c:213: error: base_tag' undeclared (first use in this function) ../srtp/ekt.c:213: error:base_tag_len' undeclared (first use in this function)

    ../srtp/ekt.c:224: error: pkt_index' undeclared (first use in this function) ../srtp/ekt.c:243: error:packet_len' undeclared (first use in this function)
    ../srtp/ekt.c: At top level:
    ../srtp/ekt.c:258: error: syntax error before "ekt"
    ../srtp/ekt.c: In function srtcp_ekt_trailer': ../srtp/ekt.c:266: error:ekt' undeclared (first use in this function)

    make.exe: *** [../srtp/ekt.o] Error 1

    Execution terminated

     
    • Greg

      Greg - 2007-08-10

      Thanks Clifford for all your help. i checked my files against the cvs and it turns out my files was corrupted and litterally missing the typdef. downloaded the new one and having similiar troubles now where it tells me, there aren't a members of a particualar structure.

      obviously there must be because other people have been using the library before me but for some reason when i download the library i keep getting files missing and parts of the files missing. trying to work that out now. however thank you for the help in tracking down the previous error messages.

       
    • Anonymous

      Anonymous - 2007-08-07

      What is weird is that you should think that these are linker errors - they are compiler errors.

      "Bothering" the project page won't help, the 'project' is for the IDE not the compiler.

      "David Gale" is not a good folder name to use, it contains spaces - the "PLEASE READ BEFORE POSTING A QUESTION" thread explains why that is not a good idea. Apart from that it really does not protect your anonymity! ;-)

      I see no evidence in the log that "the .c file can't get the .h file for the functions prototypes", what I see is header files containing syntax errors. The forst of which is teh syntax error befor the token 'ekt' in line 78 of ekt.h. You have to read the error messages - from the top - many of the the subsequent errors are likely to be merely a consequence of the first; fix it, rebuild, fix the next.

      Without sight of line 78 of ekt.h it is not possible to help you with the actual error.

      Clifford

       
    • Nobody/Anonymous

      thanks clifford for the response. I'm having trouble getting in touch with the project page so maybe you can see the "syntax errors" it says are in this file. i've changed the path so there aren't any more spaces as well.
      code:
      =======

      /
      * ekt.h
      *
      * interface to Encrypted Key Transport for SRTP
      *
      * David McGrew
      * Cisco Systems, Inc.
      /
      /

      * Copyright (c) 2001-2005 Cisco Systems, Inc.
      * All rights reserved.
      *
      * Redistribution and use in source and binary forms, with or without
      * modification, are permitted provided that the following conditions
      * are met:
      *
      * Redistributions of source code must retain the above copyright
      * notice, this list of conditions and the following disclaimer.
      *
      * Redistributions in binary form must reproduce the above
      * copyright notice, this list of conditions and the following
      * disclaimer in the documentation and/or other materials provided
      * with the distribution.
      *
      * Neither the name of the Cisco Systems, Inc. nor the names of its
      * contributors may be used to endorse or promote products derived
      * from this software without specific prior written permission.
      *
      * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
      * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
      * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
      * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
      * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
      * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
      * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
      * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
      * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
      * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
      * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
      * OF THE POSSIBILITY OF SUCH DAMAGE.
      *
      */

      /
      * EKT implementation strategy
      *
      * use stream_template approach
      *
      * in srtp_unprotect, when a new stream appears, check if template has
      * EKT defined, and if it does, then apply EKT processing
      *
      * question: will we want to allow key-sharing templates in addition
      * to EKT templates? could define a new ssrc_type_t that's associated
      * with an EKT, e.g. ssrc_any_ekt.
      *
      *
      /

      ifndef EKT_H

      define EKT_H

      ifdef __cplusplus

      extern "C" {

      endif

      /in the same dir as ekt.h so no need for implicit path/

      include "srtp_priv.h"

      define EKT_CIPHER_DEFAULT 1

      define EKT_CIPHER_AES_128_ECB 1

      define EKT_CIPHER_AES_192_KEY_WRAP 2

      define EKT_CIPHER_AES_256_KEY_WRAP 3

      typedef uint16_t ekt_spi_t;
      unsigned ekt_octets_after_base_tag(ekt_stream_t ekt);

      /
      * an srtp_policy_t structure can contain a pointer to an
      * ekt_policy_t structure
      *
      * this structure holds all of the high level EKT information, and it
      * is passed into libsrtp to indicate what policy should be in effect
      /

      typedef struct ekt_policy_ctx_t {
      ekt_spi_t spi; / security parameter index /
      uint8_t ekt_cipher_type;
      uint8_t ekt_key;
      struct ekt_policy_ctx_t
      next_ekt_policy;
      } ekt_policy_ctx_t;

      /
      * an ekt_data_t structure holds the data corresponding to an ekt key,
      * spi, and so on
      /

      typedef struct ekt_data_t {
      ekt_spi_t spi;
      uint8_t ekt_cipher_type;
      aes_expanded_key_t ekt_enc_key;
      aes_expanded_key_t ekt_dec_key;
      struct ekt_data_t *next_ekt_data;
      } ekt_data_t;

      /
      * an srtp_stream_ctx_t can contain an ekt_stream_ctx_t
      *
      * an ekt_stream_ctx_t structure holds all of the EKT information for
      * a specific SRTP stream
      /

      typedef struct ekt_stream_ctx_t {
      ekt_data_t data;
      uint16_t isn; /
      initial sequence number */
      uint8_t encrypted_master_key[SRTP_MAX_KEY_LEN];
      } ekt_stream_ctx_t;

      err_status_t
      ekt_alloc(ekt_stream_t *stream_data, ekt_policy_t policy);

      err_status_t
      ekt_stream_init(ekt_stream_t e,
      ekt_spi_t spi,
      void *ekt_key,
      unsigned ekt_cipher_type);

      err_status_t
      ekt_stream_init_from_policy(ekt_stream_t e, ekt_policy_t p);

      err_status_t
      srtp_stream_init_from_ekt(srtp_stream_t stream,
      const void *srtcp_hdr,
      unsigned pkt_octet_len);

      void
      ekt_write_data(ekt_stream_t ekt,
      void base_tag,
      unsigned base_tag_len,
      int
      packet_len,
      xtd_seq_num_t pkt_index);

      /
      * We handle EKT by performing some additional steps before
      * authentication (copying the auth tag into a temporary location,
      * zeroizing the "base tag" field in the packet)
      *
      * With EKT, the tag_len parameter is actually the base tag
      * length
      /

      err_status_t
      ekt_tag_verification_preproces(uint8_t pkt_tag,
      uint8_t
      pkt_tag_copy,
      unsigned tag_len);

      err_status_t
      ekt_tag_verification_postproces(uint8_t pkt_tag,
      uint8_t
      pkt_tag_copy,
      unsigned tag_len);

      /
      * @brief EKT pre-processing for srtcp tag generation
      *
      * This function does the pre-processing of the SRTCP authentication
      * tag format. When EKT is used, it consists of writing the Encrypted
      * Master Key, the SRTP ROC, the Initial Sequence Number, and SPI
      * fields. The Base Authentication Tag field is set to the all-zero
      * value
      *
      * When EKT is not used, this function is a no-op.
      *
      /

      err_status_t
      srtp_stream_srtcp_auth_tag_generation_preprocess(const srtp_stream_t s,
      uint8_t
      pkt_tag,
      unsigned pkt_octet_len);

      / it's not clear that a tag_generation_postprocess function is needed /

      err_status_t
      srtcp_auth_tag_generation_postprocess();

      ifdef __cplusplus

      }

      endif

      endif / EKT_H /

       
    • Anonymous

      Anonymous - 2007-08-08

      You have used a typp "ekt_stream_t" but never defined it.

      Clifford

       
      • Anonymous

        Anonymous - 2007-08-08

        ... or a 'type' even.

        Clifford

         
    • Nobody/Anonymous

      clifford thank you very much i've been looking at this code awhile now. i traced the program and found out that the ekt_t is really a pointer to another struct. however i have the necessary files included for that struct the ekt_t is really a pointer to and still getting the same errors. i will take a breather from it and attack it again, but at least i know where everything is now. thank you very much and let me know any other thoughts.
      greg

       
    • Anonymous

      Anonymous - 2007-08-08

      It looked like ekt_stream_t to me, not ekt_t, but no matter. The problem is not that the struct is not available but that the typedef is not available. Line 78 needs to see the type definition, the type definition needs to see the structure.

      The only file included in ekt.h is srtp_priv.h, so are you saying that is where ekt_stream_t is defined?

      The only other way ekt.h could 'see' ekt_stream_t is if it were defined before line 48 of ekt.c (where ekt.h is included), either directly or in an include file - but relying on that is not a good idea - it is unmaintainable, header files should contain all they need to be self contained.

      My other thoughts are that you have left me guessing rather than providing more information. If you changed something and still get errors, be clear about what you changed and post the new log. Are you sure the errors are exactly the same? Note I only addressed the error for ekt.h:75, the others seemed likely to have similar or same root cause, but you may still have others - if you are still stuck, you have to keep posting the logs.

      Clifford

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.