|
Did you configure the Project properties for
Linker --> Input --> Additional Dependencies. ?
Maxwell Chen
|
|
|
|
|
Yes. I've just added libpqxx.lib, per the instructions in the readme file,
Regards,
Sternocera
|
|
|
|
|
The problem is that I cannot link to libpqxx_static.lib/libpqxx_staticD.lib and not to libpqxx.lib/libpqxxD.lib (fatal error LNK1104: cannot open file), and, conversely, I cannot link to libpqxx.lib/libpqxxD.lib and not to libpqxx_static.lib/libpqxx_staticD.lib (fatal error LNK1104: cannot open file).
They are dependent on each other, but prevent each other from working, it would seem!
|
|
|
|
|
by apending more input to my additional dependencies (essentially all my libs, both those of the wrapper and the underlieing api), I get the following linker errors:
<br />
1>ibpq.lib(fe-misc.obj) : error LNK2001: unresolved external symbol __imp__select@20<br />
1>libpq.lib(fe-connect.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0<br />
1>libpq.lib(fe-misc.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0<br />
<br />
What do you think these mean?
Regards,
Sternocera
|
|
|
|
|
That you have not specified ws2_32.lib as a dependency
They are routines from the WinSock library.
Steve S
Developer for hire
|
|
|
|
|
Would you mind modifying your post? it is breaking forum(it is having 2357 lines).
Prasad
MS MVP - VC++
|
|
|
|
|
Ok. I've solved the problem anyway - I simply forget to link to the winsock api
|
|
|
|
|
can any body help me
malik
|
|
|
|
|
|
|
CreateWindow or CreateDialog or CreateDialogParam are helpful for you.
|
|
|
|
|
Hi all
I have piece of code like this ...
char* str;
str= new char[30];
str = new char[20];
....
delete str;
Here what will happen ?
To try it , with VS2003 I did not face any memory leaks (Or did I fail to notice it ?)
My question is : When a "new" is called second time to allocate 20 bytes what will happen to the first 30 bytes allocated ?
Will "new" make sure the first 30 bytes are freed ?
I noticed one thing . After the first "new" the location of str was 0x60878776 . After the second "new" the str was pointing to 20 bytes starting from 0x83422323 . Does it mean memory of 0x60878776 is free ?
redindian
|
|
|
|
|
Let me check where the data is...
But before that, I have to say that your syntax is wrong. It should be:
char* str;<br />
str= new char[30];<br />
str = new char[20];<br />
delete <big>[]</big> str;
Maxwell Chen
|
|
|
|
|
Visual C++ 2005 reuses the first address of str where it was allocated.
Maxwell Chen
|
|
|
|
|
So you mean to say in VS2003 or VC++ 6 the first memory block will be still occupied ?
redindian
|
|
|
|
|
i would have thought so as you haven't freed it explicitly, or your compiler has done it for you, why don't you put cout << "destructor\n"; in your destructor and see?
paul
if ignorance is bliss then knock the smile off my face!!!
|
|
|
|
|
dharani wrote: When a "new" is called second time to allocate 20 bytes what will happen to the first 30 bytes allocated ?
The allocated memeory will become inaccessible (and thus un-deletable), because you do no longer have a 'handle' to it.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
So how to avoid such a scenario ?
I am trying to find answer ...
redindian
|
|
|
|
|
dharani wrote: So how to avoid such a scenario ?
<br />
delete[] the old memoryadress before reallocating.
Hold the new address in another variable.
Use a string class (e.g. std::string or CString ), which handles the memory for you.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Use realloc .
Regards,
Paresh.
|
|
|
|
|
You shoudln't mix new and realloc.
"What's on your mind, if you will allow the overstatement?"
|
|
|
|
|
Yes, you are right. I was thinking in malloc context.
Regards,
Paresh.
|
|
|
|
|
swathee wrote: You shoudln't mix new and realloc.
offcouse..
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief
|
|
|
|
|
Use std::string instead of char arrays.
|
|
|
|
|
dharani wrote: I am trying to find answer ...
CString is much better optimized in this case!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief
|
|
|
|