tekninja Posted January 23, 2008 Share Posted January 23, 2008 I am hoping someone here can help me... I am trying to compile a very simple C++ program using the dswifi headers, but unfortunately I get the following errors when I try to build my project: test.o: In function `main':test.cpp:43: undefined reference to `socket'test.cpp:46: undefined reference to `htons'test.cpp:47: undefined reference to `inet_addr' I have the necessary headers in my include path (sys/socket.h, netinet/in.h), and the compiler is apparently seeing them as I do not get errors saying those header references don't exist. I am wondering if the errors I am getting have something to do with the above functions not being defined in those headers, but instead being of type 'extern.' However I'm not sure where this extern references to? I think I may just have to manually link library files when I build, but I am not sure which library files I need to link? I have the latest devkitPro and MSYS installed. For the curious here is my retarded simple program (and yes I know there is a lot more I need in there to get it to work on the DS, but I just want to get this to compile first) #include <string.h>#include <stdio.h>#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h> #define DESTIP "192.168.1.101" //IP Of Server#define DESTPORT 30500 //Port on server to connect to int main() { int destFD; //file descrip of destination socket struct sockaddr_in dest_addr; //destination address info destFD = socket(AF_INET, SOCK_STREAM, 0); //initialize file descripter based on address family and socket type dest_addr.sin_family = AF_INET; //host byte order = Address Family Internet dest_addr.sin_port = htons(DESTPORT); //network byte order = Host To Network Short(MYPORT) dest_addr.sin_addr.s_addr = inet_addr(DESTIP); //convert IP string to binary address memset(&(dest_addr.sin_zero), '\0', ; //zero the rest of the struct return 0; } Any help much obliged Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now