cvs commit: hints errors.txt

tushar at linuxfromscratch.org tushar at linuxfromscratch.org
Fri Jan 23 16:36:33 PST 2004


tushar      04/01/23 17:36:33

  Modified:    .        errors.txt
  Log:
  Updated: errors.txt
  
  Revision  Changes    Path
  1.7       +43 -4     hints/errors.txt
  
  Index: errors.txt
  ===================================================================
  RCS file: /home/cvsroot/hints/errors.txt,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -u -r1.6 -r1.7
  --- errors.txt	11 Nov 2003 05:19:18 -0000	1.6
  +++ errors.txt	24 Jan 2004 00:36:33 -0000	1.7
  @@ -35,10 +35,10 @@
   
   Mostly, further information about the errors are missing, which is a nuisance
   for both the one who asks and the one who tries to answer, because of the
  -annoying dialogue that is often following. I have to admid that the LFS mailing
  +annoying dialogue that is often following. I have to admit that the LFS mailing
   list and IRC never failed to solve my problems (and that in a rather cheerful
   way), but I reached a point at where I wanted to solve as many of my problems
  -as possible. So I had to learn a much, which was undoubtedly fun.
  +as possible. So I had to learn a lot, which was undoubtedly fun.
   
   WHAT KIND OF ERROR?
   
  @@ -60,7 +60,7 @@
                                           ` Prog 
           				  only
   
  -That looks pretty simple, eh? But that's only the beginning. We will have a 
  +That looks pretty simple, eh? But that is only the beginning. We will have a 
   look at each of these error types closely!
   
   1. Compile-time Errors
  @@ -78,7 +78,7 @@
   
   There is a lot gcc may be unable to find. If there is something to include, it 
   may be the file that should be included, that is missing. The questions here 
  -are: 1. what's missing? and 2. what to do against?
  +are: 1. what is missing? and 2. what to do against?
   
   1.1.1.1 Missing header file
   
  @@ -167,6 +167,42 @@
   include it, otherwise copy and paste the definition into the file gcc is
   complaining about.
   
  +Sometimes it's not the definition, but a missing argument to a function. The 
  +last living example of this gizmo was an error due to some API change in the
  +alsa-1.0-pre driver when compiling any alsa-enabled package that used at least 
  +one of the snd_pcm_hw_param-functions (e.g. mplayer or wine). The related error
  +was displayed as:
  +
  +audio.c: In function `Alsa_TraceParameters':
  +audio.c:292: error: too few arguments to function `snd_pcm_hw_params_get_format'
  +(...)
  +
  +In this case you need to know what arguments the function is expecting.
  +Therefore, we seek the header file that defines the function (like explained 
  +for missing functions). For our alsa example, the line in the header file was
  +in /usr/include/alsa/pcm.h and looked like:
  +
  +int snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params,
  +snd_pcm_format_t *val);
  +
  +While the code from which that function was invoked only used:
  +
  +(...) format = snd_pcm_hw_params_get_format(hw_params);
  +
  +One must notice that only the first argument is given, the other argument
  +"snd_pcm_format_t" of the type "*val" is missing. Now we need to know what
  +type *val is, then we could insert it into audio.c.
  +
  +1.1.1.3 function bla... redefined
  +
  +Another almost similar error occurs if something is defined twice. The compiler
  +is unable to tell if both definitions are equal, so it will give the error even
  +in that case. You have to search for the definitions, check out which one is 
  +valid for your case and embrace the "invalid" function with "#ifndef <Name>"
  +and "#endif". One could easily remove the "invalid" definition, but if another
  +package would need it, it would be missing then, so the #ifndef/#endif-way is
  +clearly the better one.
  +
   1.1.2 Linking (ld)
   
   Linking mostly fails because of missing libraries. Make sure your
  @@ -321,6 +357,9 @@
     [2003-11-10]
       * Adding a Links section with a link to a book that helps in aquiring C++ 
         Skills.
  +
  +  [2004-01.20]
  +    * Added a short section about redefined functions.
   
   CREDITS:
   Thanks to teemu for reminding me on "-I" and "-l" as much as Tushar for the 
  
  
  



More information about the hints mailing list