Winsock Coding Issue - winsock

I am trying window socket programming in c++.I am using winsock2.h for this purpose.i am doing this in code blocks using GNU GCC and getting errors as shown in attachment as you can see.This is important to know that I trying just client server model.
I am not putting my code here because code is available on msdn(I have just copied from there).I am just providing link
Server code
https://msdn.microsoft.com/en-us/library/windows/desktop/ms737593(v=vs.85).aspx
client code
https://msdn.microsoft.com/en-us/library/windows/desktop/ms737591(v=vs.85).aspx

Posted a comment, but confident enough to make an answer...
The screenshot you included shows Linker errors, so everything is probably compiling correctly. To use WinSock2, your program must link with Ws2_32.lib, which is a standard system library included with the Windows SDK.
SDK stands for Software Development Kit. It contains many header files and libraries that are needed to write software for Windows. Sorry if this is too basic, but... You included the header file WinSock2.h. That header only includes the declarations for all the WinSock functions - just a description of the functions. The function definitions (the code for the functions) is located in a library that you have to "link" with. In some cases you will get source code for a library that you can compile with, but most of the time you will only get a pre-compiled LIB file such as Ws2_32.lib. The Windows SDK contains the LIB files for most of the programs you can write for Windows.
For more information search for "linking", "Win32 libraries", and "dynamic link libraries" (DLLs).

Related

Why can't I debug into UnityEngine.UI code?

I add the UnityEngine.UI.dll and UnityEditor.UI.dll to my assets folder with their mdb files . also i add the both project to my current project. i am sure all the unity engine ugui code build success, because i debug log in the event system, and it print message. when i want to step into the event system class, i always failed . I find unity will load the code from a build path ,rather than i original code. Why does it do this ? if i want to debug unity engine ugui code, what should i do ?
To debug code, you need two things:
Symbols, the list of all functions, classes, variables used throughout the module. When using C++ symbols are stored in special .pdb files on Windows (and you obviously are using Windows since you are talking about dlls). Symbols in C# (.NET in general) are stored in the .dll itself. Having symbols will let you see the name of functions on the call stack and possibly some variables but nothing more.
Source code of the module.
U3D's source code is proprietary - you need to spend a good amount of money to receive it. And if I am guess to - UnityEngine.UI.dll is a C++ module with stripped (removed) symbols removed.
Thus you have neither, so you can't debug U3D's code at all.
Why would you need to that anyway? If you want to see how the internals of a big game engine work, there are plenty of other options (for example UE4 and Lumberyard). If you are struggling with a problem and you'd like to be able to solve it through debugging...well though luck. Your best bet would be to ask in unity community.

SDL.h "Program file does not exist"

I'm pretty new to c++ (and programming in general) and I'm currently trying to inlcude the "SDL.h" header into a c++ project in Eclipse (I use minGW btw). I've provided the project with the paths to the the header files and the library of SDL. However, whenver I specifically include "SDL.h" and the build then project I get the following Message:
" 'Launching SDL Basic.exe' has encountered a problem. Program file does not exist. "
I'm pretty sure that this has to do with the fact that no .exe file is generated whenever I build the project with SDL.h included. What I don't get is why this happens. When I include some other SDL header, such as SDL_assert, this is not a problem. Then the .exe file is generated just as usual and the program runs just as it should.[enter image description here][1]
http://i.stack.imgur.com/cdV8U.jpg How it looks when SDL.h is included.
http://i.stack.imgur.com/MW7PX.jpg How it looks when something else from SDL is included.
I seem to have fixed the problem. Whenever I ran the program the console window outout " undefined reference to 'Winmain#16' ". So I googled on it and found out that SDL defines its own main function in SDL_main.h, which in total would give me two main functions. To prevent SDL from defining its own main function I had to define the macro SDL_MAIN_HANDLED before I included SDL.h, and look, it worked:
http://i.stack.imgur.com/mNOOE.jpg
If someone can explain this in more detail I'd really appreciate it.
I did a little research and it looks like the undefined reference to WinMain#16 is because SDL is automatically creating a Windows entry point for your application, but you haven't provided the necessary libraries to link in the SDL implementation of that entry point. However, if you intend to use the SDL functionality, you really do need that entry point, because it performs several important initialization steps necessary to leverage the SDL features that you presumably want to use.
Defining SDL_MAIN_HANDLED is a mechanism that would allow you to provide your own Windows entry point (i.e.: WinMain), but that is a more complicated approach (albeit more flexible). This only solves your problem because it happens to prevent "main" from being redefined to "SDL_main" which in turn means that your .cpp file no longer even requires any of the SDL libraries. So it compiles and links, but you won't have any of the SDL functionality you're looking for.
You need to link in the appropriate libraries. See here - it provides some info that might help.

WebRTC in iPhone (gas-preprocessor issues)

I'm trying compile the lastest WebRTC version for iPhone. I not need to compile the entire solution, I only need to compile the VAD module.
To do that, I have created a Xcode project and I have tried to compile the source necessary, but I have a problem with the *.s files and its assembler.
Like in the FFMPEG library, I know that I must "translate" the assembler code to an assembler code that the gcc for iPhone understand, but I don't know how I do this manually.
I have tried to create a configure file and set in it "as=gas-preprocessor.pl" (like in FFMPEG), but does not work.
Any idea? How do I run the gas-preprocessor.pl manually?
Thanks.
I'm just finishing it on iOS and has built standalone static libraries of NS/VAD/AECM and AGC, here's some tips for you, and hope you success:
1. Source File List
for standalone VAD build, you should make sure your project has all of these files(no .s file needed), and I'm not listed the header files here, you will get some header file can not be found errors, just fixing it and things will be done.)
webrtc_vad.c
vad_core.c
vad_filterbank.c
vad_gmm.c
vad_sp.c
real_fft.c
division_operations.c
complex_bit_reverse.c
cross_correlation.c
complex_fft.c
downsample_fast.c
vector_scaling_operations.c
get_scaling_square.c
energy.c
min_max_operations.c
spl_init.c
2. Adding a macro called WEBRTC_MAC
I'm not sure why the Xcode environment does not provide this macro, but it should be defined to ensure that WEBRTC_POSIX is enabled. To define this macro, adding it to a new header file or just define it in the webrtc-header-files.
3. Following these steps to build and setup a static library of WebRTC-VAD module on iOS
notice, do not use LLVM 2.0 to compile the VAD module(use GCC or LLVM GCC). cus' it can throw you lots of errors when compiling some webrtc variable declarations.
4. Using the libwebrtc_vad.a
if you got this far, things are easy to go, just include webrtc_vad.h and using the API provided by this module. and vad is working fine in my case.
hope i helped.
try to check this link https://groups.google.com/forum/?fromgroups=#!topic/discuss-webrtc/VJg-fk2-i_0 i believe you have to set inline assembly correctly. I am also onto this so let me know if you want to switch emails or something.

Monotouch and native iOS code

Is it possible to link a C# library compiled using monotouch with an objective-C front end in a single application, or does the app have to be all or nothing?
It is possible but you aren't going to get any help from the MonoTouch tooling and you can't get away from the fact that you still have to have the Mono runtime to execute your C# code.
In order to provide the Mono runtime to the Objective-C app, the runtime will have to be embedded into the app. The MonoTouch site has some docs on how to do this here and you can find more technical details about embedding Mono into your application here.
MonoTouch, when compiling your C# code, produces .m and .s files that are used by Objective-C to call that code. These files will need to be included in the consuming Objective-C project but MonoTouch cleans up those files after they've been used. In order to keep mtouch, the MonoTouch compiler, from deleting the .m and .s files, use the --keeptemp option when invoking the compiler. You can find a good sample Makefile here to help you figure out how to call mtouch correctly from the command line.
Finally, you will need the full version of MonoTouch in order to do this. The trial version will not generate the .s files.

SNMP Library for iPhone

Are there any open source libraries for doing SNMP GET/SETs using the Objective C/Cocoa Touch (for IPhone)?
Although there is no SNMP implementations in Objective-C (that i an aware of). There are in C & C++.
I've had success at using snmp++v2.8a. Just drop the .h and .cpp files required for the static libsnmp++.a into your x-code iphone project. And make the necessary tweaks for it to build. I had to add: "-D_XPG4_EXTENDED -DGCC -DLINUX" to Project Settings 'Other C++ Flags', and make some changes to the files. Then any file you are using the c++ objects from, rename from .m to .mm, to tell X-Code the file contains a mixture of objective-C and c++.
In my opinion, the C/C++ package called Net-SNMP (has nothing to do with .NET) is the best implementation of an SNMP library for both the manager (client) and the agent (server) sides. I've looked at a lot of them and used a lot of them, and Net-SNMP is the best of the lot. Open source.
I've spent some time working on building one of these for a project.
there's none for obj-c, or at least there weren't when I was looking last summer. there's a bunch of open source ones in c and c# that are a good starting spot for a port (or re-implementation).
I've never heard of one, and the only thing I'm finding on Google is "IP*Works!", but it seems to be a Mac framework (and might not work on iPhone if it's not compiled as a .a file).
Your best bet may be to roll your own. http://cocoabuilder.com has a couple emails in its archives about people asking for SNMP libraries, but no answers were ever received.