The first thing you did wrong was not posting the complete Compile Log without modification or omission.
I suspect from what little information you hace provided taht you are attempting (or purpose or inadvertently) to link a library intended for use with a different toolchain. Possibly Microsoft or Cygwin. A Cygwin installation can cripple a Dev-C++ or MinGW installation in strange ways if it has priority on the search path environment variable (and vice versa!)
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You still did not post the "Compile Log"! That's the text on the "Compile Log" tab not the "Compile" tab.
The .a file is the one you need, the .lib is for a different compiler/linker (probably Microsoft).
Now there are two possibilities, including.
1) function_library() does not exists in library.a
2) You linked it incorrectly and library.a is not being found
3) You compiled as C but the library is C++
4) The library was for Cygwin, or Linux or some other platform not MinGW
The Compile Log will help answer some of the above. Since teh header obviously contains a valid declaration, I suspect that you did not actually link it correctly. The Compile Log will tell us exactly how your project is configured.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> they told me that libreria.lib was compiled with visual c++6.0.
But we are now using libreria.a, so that is academic. You need to know what that was compiled with. Since you could use the free VC++ 2008 Express Edition to link a VC++ 6 library, why don't you just do that?
> But the following ones, i don´t know how:
As I said before post the Compile Log, not mere fragments! These symbols are an integral part of the C runtime, you have really munged something up here.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
libreria.o:
U Classifier
U free
00000000 D license_status
U LicenseCheck
00000040 T funcion_librari
00000000 T funcion_librari2
000005fc T funcion_librari3
000002e8 T funcion_librari4
00000648 T funcion_librari5
00000120 T funcion_librari6
00000048 T funcion_librari7
U usleep
Compilador: Default compiler
Building Makefile: "D:\Nuevos\Pruebas\Makefile.win"
Ejecutando make...
make.exe -f "D:\Nuevos\PruebasClasificador\Makefile.win" all
gcc.exe source/main.o -o "Pruebas.exe" -L"C:/Dev-Cpp/lib" C:/libnrc.a
source/main.o(.text+0x39):main.c: undefined reference to `funcion_librari'
collect2: ld returned 1 exit status
make.exe: *** [Pruebas.exe] Error 1
Ejecución Terminada
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> I´m testing diffents situations and differents librarys.
Hey, let's try and fix one problem at a time or none at all!
Try specifying the full path instead of just "include/libreria.a". If the linker does not find a file specified on the command line, it simply ignores it.
With respect to VC++ why were you even trying to link libc.lib!? In that case the information we would need is in file://c:\Projects\Prueba\Prueba\Debug\BuildLog.htm and you did not post that.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi!
When i compile my proyect, i´ve got this errors:
.drectve
-defaultlib:uuid.lib ' unrecognized .drectve
-defaultlib:LIBC ' unrecognized.drectve `-defaultlib:OLDNAMES ' unrecognized
..........
¿what i´m doing wrong?
The log shoes that you are attempting to link "C:/libnrc.a", what happened to "include/libreria.a"!?
It is hard to follow your moving target!
Clifford
> ¿what i´m doing wrong?
The first thing you did wrong was not posting the complete Compile Log without modification or omission.
I suspect from what little information you hace provided taht you are attempting (or purpose or inadvertently) to link a library intended for use with a different toolchain. Possibly Microsoft or Cygwin. A Cygwin installation can cripple a Dev-C++ or MinGW installation in strange ways if it has priority on the search path environment variable (and vice versa!)
Clifford
Hi!
Sorry, you are right!
The client provide two librarys... library.a, library.lib and library.h
The example program than i´m using is this:
include <library.h>
int main(int argc, char *argv[])
{
function_library();
}
The program to compile de proyect is dev-c++.
I put the library in the liker option of the compiler.
Two diferents compiling results:
In function
main': [Linker error] undefined reference to
function_library'ld returned 1 exit status
[Build Error] [Pruebas.exe] Error 1
.drectve
-defaultlib:uuid.lib ' unrecognized .drectve
-defaultlib:uuid.lib ' unrecognized.drectve
-defaultlib:LIBC ' unrecognized .drectve
-defaultlib:OLDNAMES ' unrecognized........... The .drectve linerepeats a lot of times
...........
[Linker error] undefined reference to
_chkstk' [Linker error] undefined reference to
GetIfTable@12'[Linker error] undefined reference to
GetIfTable@12' [Linker error] undefined reference to
GetIfEntry@4'[Linker error] undefined reference to
_allmul' [Linker error] undefined reference to
_chkstk'[Linker error] undefined reference to `_chkstk'
ld returned 1 exit status
[Pruebas.exe] Error 1
I remove from the path the cywin instalation, so i use only dev-c++ compiler.
Any idea?
Thanks a lot!
You still did not post the "Compile Log"! That's the text on the "Compile Log" tab not the "Compile" tab.
The .a file is the one you need, the .lib is for a different compiler/linker (probably Microsoft).
Now there are two possibilities, including.
1) function_library() does not exists in library.a
2) You linked it incorrectly and library.a is not being found
3) You compiled as C but the library is C++
4) The library was for Cygwin, or Linux or some other platform not MinGW
The Compile Log will help answer some of the above. Since teh header obviously contains a valid declaration, I suspect that you did not actually link it correctly. The Compile Log will tell us exactly how your project is configured.
Clifford
Hi!
You are right again.
When i compile using '.a'
/Compilador: Default compiler
Building Makefile: "D:\Nuevos\Pruebas\Makefile.win"
Ejecutando make...
make.exe -f "D:\Nuevos\Pruebas\Makefile.win" all
gcc.exe -c source/main.c -o source/main.o -I"D:/Dev-Cpp/include" -I"D:/Nuevos/Pruebas/include"
gcc.exe source/main.o -o "Pruebas.exe" -L"D:/Dev-Cpp/lib" include/libreria.a
source/main.o(.text+0x2b):main.c: undefined reference to `funcion_librari'
collect2: ld returned 1 exit status
make.exe: *** [Pruebas.exe] Error 1
Ejecución Terminada [Linker error] undefined reference to `_chkstk'
For the library to link it must be in either of the following locations:
D:/Dev-Cpp/lib/include/libreria.a
D:/Nuevos/Pruebas/include/libreria.a
Where is it? Is it in one of those?
You can check which symbols are defined in libreria.a by using the nm.exe utility.
Clifford
Hi again!
The library is in ... D:/Nuevos/Pruebas/include/libreria.a
I talk to the client this evening, and they told me that libreria.lib was compiled with visual c++6.0.
Do you think i could use library.lib in dev-c++? Which 'includes' will be needed?
I´ll check symbols for libreria.a later.
Thanks a lot!
I almost forget another thing,
I solved the following link errors including the library 'libiphlpapi.a' in the linker option of dev-c++.
[Linker error] undefined reference to
GetIfTable@12' [Linker error] undefined reference to
GetIfTable@12'[Linker error] undefined reference to `GetIfEntry@4'
But the following ones, i don´t know how:
[Linker error] undefined reference to
_chkstk' [Linker error] undefined reference to
_allmul'[Linker error] undefined reference to
_chkstk' [Linker error] undefined reference to
_chkstk'Thanks!
> they told me that libreria.lib was compiled with visual c++6.0.
But we are now using libreria.a, so that is academic. You need to know what that was compiled with. Since you could use the free VC++ 2008 Express Edition to link a VC++ 6 library, why don't you just do that?
> But the following ones, i don´t know how:
As I said before post the Compile Log, not mere fragments! These symbols are an integral part of the C runtime, you have really munged something up here.
Clifford
Hi!
The result of the command nm.exe:
libreria.o:
U Classifier
U free
00000000 D license_status
U LicenseCheck
00000040 T funcion_librari
00000000 T funcion_librari2
000005fc T funcion_librari3
000002e8 T funcion_librari4
00000648 T funcion_librari5
00000120 T funcion_librari6
00000048 T funcion_librari7
U usleep
Compilador: Default compiler
Building Makefile: "D:\Nuevos\Pruebas\Makefile.win"
Ejecutando make...
make.exe -f "D:\Nuevos\PruebasClasificador\Makefile.win" all
gcc.exe source/main.o -o "Pruebas.exe" -L"C:/Dev-Cpp/lib" C:/libnrc.a
source/main.o(.text+0x39):main.c: undefined reference to `funcion_librari'
collect2: ld returned 1 exit status
make.exe: *** [Pruebas.exe] Error 1
Ejecución Terminada
Hi!
I moved the project to another directory.
I´m testing diffents situations and differents librarys.
The command 'nm.exe' shows that the function is there, doesn´t it?
So, do you have any idea why it doesn´t work?
Compilador: Default compiler
Building Makefile: "D:\Nuevos\Pruebas\Makefile.win"
Ejecutando make...
make.exe -f "D:\Nuevos\Pruebas\Makefile.win" all
gcc.exe source/main.o -o "Pruebas.exe" -L"C:/Dev-Cpp/lib" include/libreria.a
source/main.o(.text+0x39):main.c: undefined reference to `funcion_librari'
collect2: ld returned 1 exit status
make.exe: *** [Pruebas.exe] Error 1
Ejecución Terminada
Other way, using visual studio c++ 2008 express edition witdh libreria.lib...
1>------ Operación Generar iniciada: proyecto: Prueba, configuración: Debug Win32 ------
1>Vinculando...
1>LINK : fatal error LNK1104: no se puede abrir el archivo 'libc.lib'
1>El registro de compilación se guardó en el "file://c:\Projects\Prueba\Prueba\Debug\BuildLog.htm"
1>Prueba - 1 errores, 0 advertencias
========== Generar: 0 correctos, 1 incorrectos, 0 actualizados, 0 omitidos ==========
Thanks
> I´m testing diffents situations and differents librarys.
Hey, let's try and fix one problem at a time or none at all!
Try specifying the full path instead of just "include/libreria.a". If the linker does not find a file specified on the command line, it simply ignores it.
With respect to VC++ why were you even trying to link libc.lib!? In that case the information we would need is in file://c:\Projects\Prueba\Prueba\Debug\BuildLog.htm and you did not post that.
Clifford