User forums > Help

Trying to link (and understand) static libraries.

(1/1)

19bernardo87:
Hi, I'm fairly new to API's (and programming in general) and recently started on windows.

I'm attempting to use the OPENFILENAME struct, unfortunately I get an Undefined Reference error when I try to use the function GetOpenFileName: it seems that I need to link with comdlg32.lib.

I do so by specifying in "Build Options"-"Linker Settings" and Adding "..\..\..\..\..\watcom-1.3\lib386\nt\comdlg32.lib" to "Link Libraries."

However I now get this error:
..\..\..\..\..\watcom-1.3\lib386\nt\comdlg32.lib: file not recognized: File format not recognized
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 3 seconds)
0 errors, 0 warnings

Also, for learning purposes, I'd like to know if I understand this.

The reason I get undefined reference is because the header file <windows.h> only contains the declaration of the function, its definition lies inside of comdlg32.lib, which is a set of source of files put together more or less.  Are these pre-compiled (already in object code, .o) and the linker just puts them together?

MortenMacFly:
What compiler / OS / C::B version do you use (exactly)?

You don't mix compilers, right?! "collect2" seems to me like coming from GCC compilers suite but you try to use library components from Watcom?!

19bernardo87:

--- Quote from: MortenMacFly on October 04, 2008, 04:36:36 pm ---What compiler / OS / C::B version do you use (exactly)?

You don't mix compilers, right?! "collect2" seems to me like coming from GCC compilers suite but you try to use library components from Watcom?!

--- End quote ---

You are correct, I wasn't aware static libraries were compiler specific.  Thanks a bunch. =D

Navigation

[0] Message Index

Go to full version