On Mon, 2008-03-31 at 16:26 +0200, Tijl Vercaemer wrote:
> I'm trying to compile a simple application that uses winsock2. I'm
> using arm-wince-mingw32ce-gcc version 0.51.0 (from the
> mandriva-*.tar.gz downloads) on Linux.
>
> This is what I do:
> arm-wince-mingw32ce-gcc -L/opt/mingw32ce/arm-wince-mingw32ce/lib -lws2
> -o ipvideo.exe ipvideo.c
>
> The result is a whole list of "undefined reference" errors concerning
> winsock functions.
>
> If I use grep to look for some of those function names, it finds them
> in /opt/mingw32ce/arm-wince-mingw32ce/lib/libws2.a
>
> Can anyone help me out?
>
> Thanks,
> Tijl
It's hard to know exactly what's going on without sufficient "evidence".
I was feeling a bit lame - not enough energy after work to do something
that requires my brain to be turned on - so I tried to hack up an
example. Its source is attached.
I can compile it with :
arm-wince-mingw32ce-gcc -o echo.exe echo.c -lws2
You'll need to change the IP address in the source for it to work with
your environment.
Let me know if this still doesn't work for you.
Danny
--
Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info
#include <wininet.h>
#include <winsock.h>
#include <windows.h>
// #include <netinet/in.h>
void LogMe(char *pattern, ...)
{
va_list ap;
FILE *f = fopen("/storage card/devel/log.txt", "a");
va_start(ap, pattern);
vfprintf(f, pattern, ap);
va_end(ap);
fclose(f);
}
void echo_test()
{
struct sockaddr_in sa;
int r, s;
char buf[16];
s = socket(PF_INET, SOCK_STREAM, 0);
LogMe("socket -> %d\n", s);
if (s == INVALID_SOCKET) {
r = WSAGetLastError();
LogMe("Error %d\n", r);
WSACleanup();
exit(1);
}
memset(&sa, 0, sizeof(sa));
sa.sin_family = AF_INET;
sa.sin_port = htons(7); /* echo service */
sa.sin_addr.s_addr = inet_addr("172.17.1.2");
r = connect(s, &sa, sizeof(sa));
LogMe("connect -> %d\n", r);
send(s, "Yow !", 6, 0);
buf[0] = 0;
recv(s, buf, sizeof(buf), 0);
LogMe("recv[%s]\n", buf);
}
int APIENTRY WinMain(HINSTANCE inst, HINSTANCE pi, LPWSTR cmd, int show)
{
WSADATA d;
WSAStartup(MAKEWORD(2,2), &d);
echo_test();
return 0;
}
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel