undefined reference to `_imp__FindAtomA'

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

undefined reference to `_imp__FindAtomA'

Frank Hrebabetzky-2
Please consider that I am neither an experienced C programmer nor a
windows API expert. I am using mingw with gcc version 3.4.5 on Windows
XP. Trying to link the following rudimentary program

sx11if.h:
------------------------------------------------
#include <windows.h>
#include <sx11.h>

#ifdef BUILD_DLL
/* DLL export */
#define EXPORT __declspec(dllexport)
#else
/* EXE import */
#define EXPORT __declspec(dllimport)
#endif

typedef struct
{ ECODE ec;
} Framegrabber;

EXPORT Framegrabber *Open (void);
------------------------------------------------
sx11if.c:
------------------------------------------------
#include <stdlib.h>
#include "sx11if.h"
#include "sx11f.h"

EXPORT Framegrabber *Open (void)
{
   Framegrabber *fg;
   PCI pci;

   fg = (Framegrabber *) malloc (sizeof(Framegrabber));
   if (fg==NULL) return NULL;
   if (fg->ec = X11_InitSystem (&pci))
   { free (fg);
     return NULL;
   }
} // Open
---------------------------------------------------
gets me the following error message:

gcc -shared -o sx11if.dll sx11if.o -Wl,--out-implib,libsx11if.a \
-L/c/WINDOWS/system32 -lSX11
Creating library file: libsx11if.a

c:/Programs/MinGW/bin/../lib/gcc/mingw32/3.4.5/libgcc.a(w32-shared-ptr.o):(.text+0x31):
undefined reference to `_imp__GetAtomNameA@12'

c:/Programs/MinGW/bin/../lib/gcc/mingw32/3.4.5/libgcc.a(w32-shared-ptr.o):(.text+0x159):
undefined reference to `_imp__FindAtomA@4'

c:/Programs/MinGW/bin/../lib/gcc/mingw32/3.4.5/libgcc.a(w32-shared-ptr.o):(.text+0x2b1):
undefined reference to `_imp__AddAtomA@4'

c:/Programs/MinGW/bin/../lib/gcc/mingw32/3.4.5/libgcc.a(w32-shared-ptr.o):(.text+0x2d2):
undefined reference to `_imp__FindAtomA@4'

collect2: ld returned 1 exit status

make: *** [sx11if.dll] Error 1

Can somebody tell me what is going on and what I can do? Excuse the
bunch of information, but I really don't know what is relevant.

--
Frank Hrebabetzky Tel. (48) 3239 2258
Photonita Ltda. http://www.photonita.com.br
Brazil

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) HTML/MIME encoded mail
3) Improper quoting
4) Improper trimming
Reply | Threaded
Open this post in threaded view
|

Re: undefined reference to `_imp__FindAtomA'

JonY-2
On 1/28/2009 00:50, Frank Hrebabetzky wrote:

> Please consider that I am neither an experienced C programmer nor a
> windows API expert. I am using mingw with gcc version 3.4.5 on Windows
> XP. Trying to link the following rudimentary program
>
> sx11if.h:
> ------------------------------------------------
> #include<windows.h>
> #include<sx11.h>
>
> #ifdef BUILD_DLL
> /* DLL export */
> #define EXPORT __declspec(dllexport)
> #else
> /* EXE import */
> #define EXPORT __declspec(dllimport)
> #endif
>
> typedef struct
> { ECODE ec;
> } Framegrabber;
>
> EXPORT Framegrabber *Open (void);
> ------------------------------------------------
> sx11if.c:
> ------------------------------------------------
> #include<stdlib.h>
> #include "sx11if.h"
> #include "sx11f.h"
>
> EXPORT Framegrabber *Open (void)
> {
>     Framegrabber *fg;
>     PCI pci;
>
>     fg = (Framegrabber *) malloc (sizeof(Framegrabber));
>     if (fg==NULL) return NULL;
>     if (fg->ec = X11_InitSystem (&pci))
>     { free (fg);
>       return NULL;
>     }
> } // Open
> ---------------------------------------------------
> gets me the following error message:
>
> gcc -shared -o sx11if.dll sx11if.o -Wl,--out-implib,libsx11if.a \
> -L/c/WINDOWS/system32 -lSX11
> Creating library file: libsx11if.a
>
> c:/Programs/MinGW/bin/../lib/gcc/mingw32/3.4.5/libgcc.a(w32-shared-ptr.o):(.text+0x31):
> undefined reference to `_imp__GetAtomNameA@12'
>
> c:/Programs/MinGW/bin/../lib/gcc/mingw32/3.4.5/libgcc.a(w32-shared-ptr.o):(.text+0x159):
> undefined reference to `_imp__FindAtomA@4'
>
> c:/Programs/MinGW/bin/../lib/gcc/mingw32/3.4.5/libgcc.a(w32-shared-ptr.o):(.text+0x2b1):
> undefined reference to `_imp__AddAtomA@4'
>
> c:/Programs/MinGW/bin/../lib/gcc/mingw32/3.4.5/libgcc.a(w32-shared-ptr.o):(.text+0x2d2):
> undefined reference to `_imp__FindAtomA@4'
>
> collect2: ld returned 1 exit status
>
> make: *** [sx11if.dll] Error 1
>
> Can somebody tell me what is going on and what I can do? Excuse the
> bunch of information, but I really don't know what is relevant.
>

Hi,
Are you sure you want "-L/c/WINDOWS/system32"? Try removing that part.

If it still fails, do tell about your MinGW install (such as, which
version of the runtime and w32api do you have installed).


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) HTML/MIME encoded mail
3) Improper quoting
4) Improper trimming
Reply | Threaded
Open this post in threaded view
|

Re: undefined reference to `_imp__FindAtomA'

Frank Hrebabetzky-2
JonY wrote:
> On 1/28/2009 00:50, Frank Hrebabetzky wrote:

>> gcc -shared -o sx11if.dll sx11if.o -Wl,--out-implib,libsx11if.a \
>> -L/c/WINDOWS/system32 -lSX11
>> Creating library file: libsx11if.a
>>
>> c:/Programs/MinGW/bin/../lib/gcc/mingw32/3.4.5/libgcc.a(w32-shared-ptr.o):(.text+0x31):
>> undefined reference to `_imp__GetAtomNameA@12'
>>
>> c:/Programs/MinGW/bin/../lib/gcc/mingw32/3.4.5/libgcc.a(w32-shared-ptr.o):(.text+0x159):
>> undefined reference to `_imp__FindAtomA@4'
>>
>> c:/Programs/MinGW/bin/../lib/gcc/mingw32/3.4.5/libgcc.a(w32-shared-ptr.o):(.text+0x2b1):
>> undefined reference to `_imp__AddAtomA@4'
>>
>> c:/Programs/MinGW/bin/../lib/gcc/mingw32/3.4.5/libgcc.a(w32-shared-ptr.o):(.text+0x2d2):
>> undefined reference to `_imp__FindAtomA@4'

>
> Hi,
> Are you sure you want "-L/c/WINDOWS/system32"? Try removing that part.
>

I copied SX11.dll from c/WINDOWS/system32 to my project directory and so
I could remove the corresponding -L option. It links without error now.

Thanks.
--
Frank Hrebabetzky Tel. (48) 3239 2258
Photonita Ltda. http://www.photonita.com.br
Brazil


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) HTML/MIME encoded mail
3) Improper quoting
4) Improper trimming