|
Let me ask an easier question:
Do you have a file called "Sockets.cpp" ?
If you have a file by that name, add it to your project, then rebuild, and see if it works.
|
|
|
|
|
Is it mandatory to add the files in the project? I mean I have the files in the same project folder but I have not added those files in my project itself. I tried doing that earlier, but it gave me around 17 linker errors on that, so I removed those files from my project.
|
|
|
|
|
The files which contain the actual implementations of the functions must be part of your project, otherwise how else does the compiler generate code for those functions?
If including the Sockets.cpp file caused more linker errors, then that means that there must be OTHER .cpp files that must ALSO be included.
|
|
|
|
|
Yes I knew about it and so I even tried adding all those 4 modules that I used to use in my previous C++ project. Now when I add all those files as well, the compiler again gives me a linker error, I will list those errors in 5 minutes from now. Please see if that makes any sense to you.
|
|
|
|
|
Linking...
Creating library Debug\Trial.lib and object Debug\Trial.exp
Sockets.obj : error LNK2019: unresolved external symbol __imp__WSAGetLastError@0 referenced in function "public: static class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> > __cdecl SocketSystem::GetLastMsg(bool)" (?GetLastMsg@SocketSystem@@SA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_N@Z)
Sockets.obj : error LNK2019: unresolved external symbol __imp__WSAStartup@8 referenced in function "public: __thiscall SocketSystem::SocketSystem(void)" (??0SocketSystem@@QAE@XZ)
Sockets.obj : error LNK2019: unresolved external symbol __imp__WSACleanup@0 referenced in function "public: __thiscall SocketSystem::~SocketSystem(void)" (??1SocketSystem@@QAE@XZ)
Sockets.obj : error LNK2019: unresolved external symbol __imp__inet_ntoa@4 referenced in function "public: static class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> > __cdecl SocketSystem::getIP(class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> > const &)" (?getIP@SocketSystem@@SA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV23@@Z)
Sockets.obj : error LNK2019: unresolved external symbol __imp__gethostbyname@4 referenced in function "public: static class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> > __cdecl SocketSystem::getIP(class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> > const &)" (?getIP@SocketSystem@@SA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV23@@Z)
Sockets.obj : error LNK2019: unresolved external symbol __imp__inet_addr@4 referenced in function "public: static class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> > __cdecl SocketSystem::getIP(class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> > const &)" (?getIP@SocketSystem@@SA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV23@@Z)
Sockets.obj : error LNK2019: unresolved external symbol __imp__socket@12 referenced in function "public: __thiscall Socket::Socket(void)" (??0Socket@@QAE@XZ)
Sockets.obj : error LNK2019: unresolved external symbol __imp__closesocket@4 referenced in function "public: __thiscall Socket::~Socket(void)" (??1Socket@@QAE@XZ)
Sockets.obj : error LNK2019: unresolved external symbol __imp__shutdown@8 referenced in function "public: __thiscall Socket::~Socket(void)" (??1Socket@@QAE@XZ)
Sockets.obj : error LNK2019: unresolved external symbol __imp__connect@12 referenced in function "public: bool __thiscall Socket::connect(class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >,int)" (?connect@Socket@@QAE_NV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z)
Sockets.obj : error LNK2019: unresolved external symbol __imp__htons@4 referenced in function "public: bool __thiscall Socket::connect(class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >,int)" (?connect@Socket@@QAE_NV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z)
Sockets.obj : error LNK2019: unresolved external symbol __imp__send@16 referenced in function "public: void __thiscall Socket::send(char const *,unsigned int)" (?send@Socket@@QAEXPBDI@Z)
Sockets.obj : error LNK2019: unresolved external symbol __imp__recv@16 referenced in function "public: void __thiscall Socket::recv(char *,unsigned int)" (?recv@Socket@@QAEXPADI@Z)
Sockets.obj : error LNK2019: unresolved external symbol __imp__listen@8 referenced in function "public: __thiscall SocketListener::SocketListener(int)" (??0SocketListener@@QAE@H@Z)
Sockets.obj : error LNK2019: unresolved external symbol __imp__bind@12 referenced in function "public: __thiscall SocketListener::SocketListener(int)" (??0SocketListener@@QAE@H@Z)
Sockets.obj : error LNK2019: unresolved external symbol __imp__accept@12 referenced in function "public: class Socket __thiscall SocketListener::waitForConnect(void)" (?waitForConnect@SocketListener@@QAE?AVSocket@@XZ)
Debug\Trial.dll : fatal error LNK1120: 16 unresolved externals
Build log was saved at "file://c:\Documents and Settings\ashu\Desktop\Trial\Trial\Debug\BuildLog.htm"
Trial - 17 error(s), 0 warning(s)
List of 17 linker errors that are generated when I include all the files that I use.
|
|
|
|
|
OK now we are getting somewhere.
You must include the Ws2_32.lib file in your project's "Additional Dependencies" property.
Do you know how to set that property?
Those functions in the error messages are located in the ws2_32.dll file.
|
|
|
|
|
How do we use boolean variables in COM?
|
|
|
|
|
Hello rahultaing,
There are actually 3 different boolean types defined in IDL :
1. The boolean type (8 bits) which is equivalent to a "char" typein C++.
2. The VARIANT_BOOL (16-bits) which is equivalent to a "short" type in C++.
3. The BOOL type (32-bits) which is equivalent to a "long" type in C++.
For inter-operability with other COM development languages like VB, always use VARIANT_BOOL.
Best Regards,
Bio.
-- modified at 3:38 Sunday 9th April, 2006
|
|
|
|
|
How do we write Constructors & Destructors in COM, Is it possible? If it is not possible then how and where should I perform the initialization task?
|
|
|
|
|
Hello rahultaing,
COM does not provide any specifications for constructors and destructors. To perform initialization for COM objects written in ATL, use the FinalConstruct() (for initialization) and FinalRelease() (for uninitialization) methods.
Best Regards,
Bio.
|
|
|
|
|
Hello,
How to freeze panes in Excel Spreadsheet?
Thanks.
|
|
|
|
|
Hello,
I want to write a simple program which adds .vcf files to outlook contacts, i mean a program which imports the .vcf file to the contacts list by doing the functionallity of (File->Import and Export->Import a VCardFile)
How can I achive this goal?
Thank you very much...
|
|
|
|
|
Hi I'm trying to import an OCX control into a dialog box. It has IDispatch interface. It fails when I try to call its methods? Can someone tell me the steps requred.
Thanks
|
|
|
|
|
Is the control being created, do you see it on the dialog?
|
|
|
|
|
I have a COM dll that is registered in HKEY_CURRENT_USER\Software\Classes.
It have the correct entries for creating it in the system provided DllSurrogate. ( Eg. DllHost.exe )
Creating an instance of it using Windows 2000 successfully launches DllHost.exe and creates the instance.
Trying the same with WinXP fails with "Class not registered".
( If i register the COM dll under HKEY_LOCAL_MACHINE it works with XP to. )
The creation under XP goes through svchost.exe ( running as system ),
it will find the registry keys registered under HKEY_CURRENT_USER but it will also try to find them under HKEY_CLASSES_ROOT and fail.
( Probably one call is done whilst impersonating and one not. )
For short, what needs to be done to successfully host a COM dll registered under HKEY_CURRENT_USER in DllHost.exe under windows XP?
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
I would to add two methods to already existing activex control. How to do go about it. Should I add a new interface. If yes, how to do it. Any article or help.
Best Regards
"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg."
- Bjarne Stroustrup
|
|
|
|
|
Do you have the source code? If Yes what version of VS are you using?
|
|
|
|
|
HI
i want to create a wrapper class of win32_Process class and i want to define my own methods into that wrapper class and after that i want to display messages whenever a new process is started or class using that wrapper class .
Can you please suggest how to procedd with this
Thanks in Advance
abhi
|
|
|
|
|
Hi.
I need to get the user's active window text from the VS.Net IDE.
so far this is what I know:
<br />
using namespace EnvDTE;<br />
<br />
CComPtr<EnvDTE::_DTE> m_pDTE;<br />
<br />
CLSID clsid;<br />
CLSIDFromProgID(L"VisualStudio.DTE",&clsid);<br />
<br />
CComPtr<IUnknown> punk;<br />
HRESULT hr = GetActiveObject(clsid,NULL,&punk);<br />
<br />
Document *ADocument;<br />
m_pDTE->get_ActiveDocument(&ADocument);
<br />
Now how can I get the full text from it ?
Thanks in Advance,
David
|
|
|
|
|
Hi,
A friend of mine told me that I can boost performance in I let my COM clients use include _i.h instead of import tlb.
Is that correct?
Thanks
|
|
|
|
|
There should be very little difference between the two. The .tlh file generated by #import produces code which is typically virtually identical to that generated by MIDL in the header file, at least for the raw interface.
Optionally and by default, #import also generates wrappers that use exceptions to report errors and extended Visual C++-only syntax to support properties. This makes it syntactically nicer to use the interfaces. Exception handling is significantly slower than error code checking, but it's the user's choice whether to use these.
If you use the TLB there are limitations on the types you can use for parameters in your interface - for example, all strings must be BSTRs, and all arrays must be SAFEARRAYs. However, you need to conform to these requirements anyway for scripting, Visual Basic and .NET interop support.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi,
I need to write an SDK for my system which is based on a proprietary camera. I thought of using COM for the interfacing of the SDK, but from what I read, I can't find a way not to marshal the video data.
I need a way to initialize a callback function and transfer a pointer to a grabbed frame. Can this be done with COM without marshaling the image data which is CPU expensive?
Is there a better recommended way of doing this? (My camera is not a standard camera, and has many special configuration and communication options).
Thank you very much,
Gil
|
|
|
|
|
how can i pass object/class/struct from any client to COM component and store it in ATL collection class which implements IEnumxxxx interface.
k.vamseedhar reddy
|
|
|
|
|
you can model the class/struct with an interface and pass that interface to the component.
|
|
|
|
|
You can use IUnknown * or IDispatch * interfaces to send the objects to COM by using reinterpret casting
Knock out "T" from CAN'T
You 'CAN' if you think you 'CAN'
|
|
|
|