|
It seems that compiler is not able to find the header file.
Specify the path of folder containing the header file in the VC++ include directories.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
after i set include path,and then compiled project, output showed below:
Linking...
LINK : fatal error LNK1104: cannot open file "psosta.lib"
Error executing link.exe.
what happened?
thanks
Li Zhiyuan
5/10/2006
|
|
|
|
|
Hence you need to perform a similar task for VC++ Library Directories (add the path of the folder containing psosta.lib ).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
how to add? my way is right to add it below? first go to tool->option..choose library..and then add a path cotaining this folder..for include path..i did with same way..right? thanks a lot.
my msn is lizhiyuan16@hotmail.com, can we talk in msn,thanks.
Li Zhiyuan
5/10/2006
|
|
|
|
|
Yes. I guess that now you've already done. Does it work?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
not yet, still this problem below:
LINK : fatal error LNK1104: cannot open file "psosta.lib"
Error executing link.exe.
Li Zhiyuan
5/10/2006
|
|
|
|
|
the direcotry of all folders are below:
folder name is pso which contains my project folder and my static folder..is this right? thanks.
after set....build-> set active configration..output showed below:
LINK : warning LNK4098: defaultlib "LIBCD" conflicts with use of other libs; use /NODEFAULTLIB:library
psoproject.exe - 0 error(s), 1 warning(s)
what is problem, thanks
Li Zhiyuan
5/10/2006
modified on Monday, January 07, 2008 6:46:12 AM
|
|
|
|
|
This usually happens when your project is linked to the C runtime both statically and dynamically. Statically linked with the debug LIBCD.lib and dynamically linked to MSVCRTD.dll. You can do either one or the other but both is a bad idea, 2 copies of the C library code, 2 copies of all the global data is a receipe for . Change your project settings to use one or the other consistently.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
i tried to do following what u said..but problem is still there,,,..what is detail to set..i go to project -> setting...general->..set MFC as DLL....?it is right? thanks
Li Zhiyuan
5/10/2006
|
|
|
|
|
It's not the link to MFC that's the issue directly it's the link to the C Runtime, a separate Dll or Lib from MFC which you may not be aware that you are using but everybody does. To know which setting to look at I'd need to know which Visual Studio version you're using?
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Hi all,
I've use a CStringArray to store some CStrings in my application. Now I want to use another CStringArray on the same application. So I add another CStringArray instance on the class view, VC++ .Net 2003.
When I add and compile it don't give any error message. But when I run the code it gives the following error.
Unhandled exception at 0x00414ff3 in TimeZone.exe: 0xC0000005: Access violation writing location 0x00000020.
On the following line of code.
m_pMainWnd = &dlg;
Why is that.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Try a better one:
#include <vector>
std::vector<CString> vec;
Maxwell Chen
|
|
|
|
|
Probably you need to post more deteails and code:
(1) the statement
Eranga Thennakoon wrote: m_pMainWnd = &dlg;
generates an exception only since you added the CStringArray ?
(2) how did you define and initialise the CStringArray ?
(3) how did you define and initialise dlg ?
...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
CPallini wrote: (1) the statement
Eranga Thennakoon wrote:
m_pMainWnd = &dlg;
generates an exception only since you added the CStringArray?
Yes, and that code line is not added by me, it's generated when I add the CStringArray variable.
CPallini wrote: (2) how did you define and initialise the CStringArray?
private:
CStringArray m_pszTimeZones;
Like this on .h file, and use IDE operations. Not write on the .h file at all.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Eranga Thennakoon wrote: it's generated when I add the CStringArray variable
Sure? It's hard to believe that CStringArray needs that statement...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Yes it is defined in InitInstance()
I appreciate your help all the time...
Eranga
|
|
|
|
|
Honestly, I haven't enough elements to give useful help to you.
Can you post bigger chunks of code?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
It's work. What I have done is after use the array clear it up as follows.
m_pszTimeZones.RemoveAll();
I appreciate your help all the time...
Eranga
|
|
|
|
|
Hi
How to open a file in Append mode using CFile
thanx in advance
-RisKhan-
|
|
|
|
|
open the file setting nOpenFlags parameter either to CFile::modeNoTruncate | CFile::modeCreate or CFile::modeWrite (depending on your needs) and then seek to the end before the very first write operation.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
I'm unfamiliar to CListCtrl::SetItemData.
I've got help from here, understanding that first you should CListCtrl::SetItemData then you can use CListCtrl::GetItemData to retrieve.
My codes:
<br />
CMyClass data;<br />
CListCtrl::SetItemData(nItem, data);<br />
But I got compilation error, "data is not a DWORD_PTR type".
How should I write the correct code?
modified on Monday, January 07, 2008 7:44:41 PM
|
|
|
|
|
You can store a pointer to the object (supposing m_pMyListCtrl is declared as CListCtrl * ):
CMyClass data;
m_pMyListCtrl->SetItemData(nItem, (DWORD_PTR) &data);
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
You should also state that this is dangerous to do if data is local to the function: the instance will be deleted when the function terminates and your pointer will point to an invalid memory location.
A better way to do this would be to:
1) have data be a member of the class. But then, that doesn't make a lot of sense in the current scenario (why would you need to store it in the data pointer of the list control then ?)
2) to create it on the heap (using new). But in that case, you must not forget to delete the pointer once you don't need it anymore (typical place would be in the class destructor and whenever you change an existing pointer).
(That was just a complement to your answer for the OP).
|
|
|
|
|
Cedric Moonen wrote: 1) have data be a member of the class. But then, that doesn't make a lot of sense in the current scenario (why would you need to store it in the data pointer of the list control then ?)
What class? I can't see any class (other than CMyClass & CLIstCtrl) in the current scenario.
(just kidding)
Of course you're right with your observations since
fantasy1215 wrote: I'm unfamiliar to CListCtrl::SetItemData.
and I guess he is also unfamiliar with object lifetime management.
Thank you.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Cedric Moonen wrote: 1) have data be a member of the class. But then, that doesn't make a lot of sense in the current scenario (why would you need to store it in the data pointer of the list control then ?)
To separate the order of the items in the control from that of the data in the control class. The control may display the items in numerous ways (alphabetical, numerical, ascending, descending, etc.) The data may not be ordered that way or convienient to do so. Nor does the data need to be a part of the list control class. It may be passed into the list control class to be acted upon but not reordered.
It mostly saves constantly looking up the item data.
However, I'm not sure if the CListCtrl item data value is guaranteed to be large enough to hold a pointer for all platforms.
YMMV
|
|
|
|