Note that there are some explanatory texts on larger screens.

plurals
  1. POg++ creating static library: could not read the symbols archive has no index
    primarykey
    data
    text
    <p>I am trying to group a number of SDL utility classes into a static library for C++ using g++. I am using ubuntu linux 11.10 and gcc versión 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3). The version of ar is 2.21.53.20110810.</p> <p>Since all files are small I am currently using only header files. I am mentioning this in case it has something to do with the problem. Also, most headers are compiled to object code with -lSDL (I am not sure that is right or even relevant, but it fails either way). Finally, there are a couple of static members for two different classes, defined in their own file to be included in the last steps of the process (triyng to follow the ODR).</p> <p>Thing is, every file is compiled to object code just fine, then an archive is created using ar but when I try to compile the main file and link it against my new library like this (being libDanGfx.a the archive I am creating):</p> <p>g++ -Wall -ansi -pedantic newmain.cpp -L. -lSDL -lDanGfx</p> <p>I get this error:</p> <p>./libDanGfx.a: could not read symbols: Archive has no index; run ranlib to add one</p> <p>This happens even after deleting all archives and object code.</p> <p>I have scouted the site and havent found an answer to the problem yet. Using ranlib did not help at all, also tried feeding the -m32 to my compiler but still to no avail. I tried in three different machines, all of them failed.</p> <p>Franky, I am thinking of dropping this whole archive thing, update the makefile and just link with the object files but I really want to know what is happening here and learn a bit in the process.</p> <p>I expect a lot of information to be missing so, just in case, I uploaded a .tar.gz file with the whole thing (just unpack and try the makefile). For your perusing, all .o files will be in the objects directory and every command used can be read in the makefile. Also, the main should display some mindless stuff on the screen (probably red squares since the resource files are not uploaded to save space, of course, .o and .a files are excluded as well).</p> <p>The file can be reached <a href="http://www.caballorenoir.net/hosted/motor_grafico.tar.gz" rel="nofollow">in this link</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload