|
From: Greg J. <gv...@gm...> - 2015-02-07 19:10:56
|
The headers are there, in winbase.h; here is a collection of how I compile:
-lshlwapi -lws2_32 \
-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32
-luuid -lcomdlg32 -ladvapi32
some of that won't be needed, of course.
On Sat, Feb 7, 2015 at 10:29 AM, Carl Sturtivant <stu...@gm...>
wrote:
> New to in-depth use of MinGW. But it's clearly the right thing!
>
> According to MSDN GetComputerNameExA is in kernel32.dll ,
> yet the following program compiles but does not link with my MinGW
> installation. Adding -lkernel32 doesn't help. Details below. Any
> suggestions how I can get linkage?
>
> ========
> #include <windows.h>
> #include <stdio.h>
>
> int main() {
> char buf[1024];
> DWORD sz = 1024;
> //GetComputerNameA( buf, &sz);
> GetComputerNameExA( 1, buf, &sz);
> printf( "\"%s\"\n", buf);
> }
> ========
>
> msys $ gcc -o gethostname gethostname.c
> C:\temp\ccmcT7xy.o:gethostname.c:(.text+0x31):
> undefined reference to `GetComputerNameExA'
> collect2.exe: error: ld returned 1 exit status
>
> msys $ gcc --version
> gcc.exe (GCC) 4.8.1
> Copyright (C) 2013 Free Software Foundation, Inc.
>
> msys $ uname -a
> MINGW32_NT-6.1 CARL 1.0.17(0.48/3/2) 2011-04-24 23:39 i686 Msys
>
> ========
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming. The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is
> your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> MinGW-users mailing list
> Min...@li...
>
> This list observes the Etiquette found at
> http://www.mingw.org/Mailing_Lists.
> We ask that you be polite and do the same. Disregard for the list
> etiquette may cause your account to be moderated.
>
> _______________________________________________
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.sourceforge.net/lists/listinfo/mingw-users
> Also: mailto:min...@li...?subject=unsubscribe
>
|