Thanks for that
I tried putting this into Code::Blocks as a console application. When I compiled I got:
Code:
C:\Sourcecode\computers\main.cpp 3 warning: ignoring #pragma comment
C:\Sourcecode\computers\main.cpp 4 warning: ignoring #pragma comment
C:\Sourcecode\computers\main.cpp In function 'main':
C:\Sourcecode\computers\main.cpp 12 warning: converting of negative value '-0x00000001' to 'DWORD'
C:\Sourcecode\computers\main.cpp 10 warning: unused variable 'dwResult'
obj\Debug.main.o In function 'main':
C:\Sourcecode\computers\main.cpp 18 undefined reference to '_WSAStartup@8'
C:\Sourcecode\computers\main.cpp 23 undefined reference to '_WNetOpenEnumA@20'
C:\Sourcecode\computers\main.cpp 26 undefined reference to '_WSACleanup@0'
C:\Sourcecode\computers\main.cpp 33 undefined reference to '_WNetCloseEnum@4'
C:\Sourcecode\computers\main.cpp 34 undefined reference to '_WSACleanup@0'
C:\Sourcecode\computers\main.cpp 37 undefined reference to '_WNetEnumResource@16'
C:\Sourcecode\computers\main.cpp 46 undefined reference to '_gethostbyname@4'
C:\Sourcecode\computers\main.cpp 48 undefined reference to '_inet_ntoa@4'
C:\Sourcecode\computers\main.cpp 51 undefined reference to '_WNetCloseEnum@4'
C:\Sourcecode\computers\main.cpp 52 undefined reference to '_WSACleanup@0'
=== Build Finished: 10 errors, 4 warnings ===
I had a play and found I needed to add the wsock32 and mpr libraries to the build myself. Is that correct? Or should the #pragma statements have done it for me?
I'm fairly new to C++ and windows programming, although have experience with other languages. I'm assuming I should have been able to just compile?
Anyway, it worked and did exactly what I need it to do
Thanks
Paul