|
A is a static instance of class CSite
<br />
class ISite<br />
{<br />
public:<br />
virtual const char* getSiteName() =0;<br />
virtual bool postRequest() =0;<br />
.....
};<br />
class CSite:public ISite<br />
{<br />
public :<br />
......<br />
}<br />
in some other cpp file,I make a static member like this:
<br />
static CSite defaultSite;<br />
Now I set Optimizations to normal in project setting!But the problem is still there!
Don't look at me in that way!
|
|
|
|
|
Can you show we where the crash occurs? I suspect you are relying on the order of static initialisation.
Steve
|
|
|
|
|
Thank you very much Hewitt!
I think I solved the problem follow your reminder.
now everything is seemed OK!
the class CSite has also some static member,and these member is defined at the 'site.cpp' ,but I define the defaultSite instance at the other cpp file (services.cpp)before!I think this is why I get a error!
Now I move the definition of defaultSite into the 'site.cpp'.
Thank you again for your help!
^_^
Don't look at me in that way!
|
|
|
|
|
I'm having a couple of little problems with a listening socket connection. I've worked with winsock before but that was a long time ago. Essentially this is the procedure.
App-A is the sender,
App-B is the receiver.
App-B is running constantly listening for a connection.
App-A(which is not always running) connects to App-B when required and sends a message, and closes the connection afterwards.
The problem I'm having is this.
if App-A executes too quickly, App-B gets an WSAECONNRESET error on calling "recv"
I can get around this by slowing App-A down with for loops/sleep commands and other such hacks, but would prefer not to do this.
The other problem I get is if App-A abnormally terminates, App-B sits in a loop constantly receiving the last message sent by App-A. This isn't a large concern as I'm deliberately causing App-A to fail as a stress test which is unlikely to occur.
I'm guessing either App-A needs to wait and ensure the message has been received before closing down, or App-B needs to queue messages somehow.
Any tips?
When I die I'd like to go peacefully in my sleep like my father, not screaming in terror like his passengers!!!
|
|
|
|
|
Hi,
are you using multiple sends and recv(s) ?
My idea is that use single send(send whole data) and do multiple recv() fn.
Once recv fn gets all bytes of data, send a single ACK to server. Thereafter you can close your server socket connection.
Bye.
Nice things do nice works
|
|
|
|
|
Thanks for the help, but I've figured it out, and the answer simply foolish .
I wasn't closing the connection correctly, hence the lack of buffer flushing
As for the repeat message, it wasn't repeating.
The message was being stored in a buffer with a static pointer, and because I neglected to check the data size returned from recv I was assuming the data pointed to was the latest message, but recv was in fact returning 0.
When I die I'd like to go peacefully in my sleep like my father, not screaming in terror like his passengers!!!
|
|
|
|
|
can someone send me the code to create application that does "autoview CD" by visual C++.
thanks verry much.
|
|
|
|
|
I think you asked this question yesterday,can you be more specific
|
|
|
|
|
Viết chương trình AutoView CD
Mô tả:
Khi chương trình chạy, thể hiện icon trên system tray.
Chương trình cần nhận biết được khi nào user đưa đĩa CD vào ổ đĩa, và tự động hiển thị danh
sách file / folder của CD lên một dialog.
Lưu ý: chỉ cần hiển thị các file/folder trong thư mục gốc của CD. Không yêu cầu cài đặt
thao tác trên file/folder (VD. mở file/folder,…)
|
|
|
|
|
What
|
|
|
|
|
when program run, show icon in system tray
program must be to know when user insert CD into drive, display automatically list file/folder of CD on a dialog
|
|
|
|
|
|
And also I think you want to read autocad files if yes see http://www.wotsit.org[^] I think its helpful for you
|
|
|
|
|
I think you want to open/load autocad files so I suggest this site but wasnt helpfuls?
|
|
|
|
|
Hello everyone,
I was wondering if anyone can be kind enough to tell me what is the difference between the Home-Made API Based Software Application that I made using Visual Studio and the Commercial Software Applications.
1- Do they use a different approach?
2- Do they have a secret recipe for their software application development?
Let me take this opportunity to thank you in advance for your help.
Khoramdin
|
|
|
|
|
What APIs are you using in your home-made application? In general, Windows apps are all based on the Win32 API, although there are several different frameworks (ATL, WTL, MFC, etc.).
|
|
|
|
|
Hi fellows
I'm using Visual C++ 2005 Express Edition and I'm getting some errors when I execute my app. This is my class that I defined in a ".h" file called "FloatText.h":
<br />
#ifndef FLOATTEXT_H<br />
#define FLOATTEXT_H<br />
class FloatText<br />
{<br />
public:<br />
FloatText();<br />
~FloatText();<br />
void SetText(char * cText);<br />
void MoveText(int iXPos, int iYPos);<br />
char * GetText();<br />
private:<br />
float m_XPos, m_YPos, m_ZPos;<br />
double m_fModelviewMatrix[16];<br />
double m_fProjectionMatrix[16];<br />
int m_iViewportMatrix[4];<br />
static int m_iTextObjects;<br />
char * m_cString;<br />
int m_iStringPos;<br />
};<br />
#endif FLOATTEXT_H<br />
I implemented this class in a ".cpp" file, and include the "FloatText.h" in the "main.cpp" too. No problems until now. When I press CTRL+F5 these errors are shown to me:
<br />
main.obj : error LNK2019: unresolved external symbol "public: char * __thiscall FloatText::GetText(void)" (?GetText@FloatText@@QAEPADXZ) referenced in function _WinMain@16<br />
main.obj : error LNK2019: unresolved external symbol "public: void __thiscall FloatText::MoveText(int,int)" (?MoveText@FloatText@@QAEXHH@Z) referenced in function _WinMain@16<br />
main.obj : error LNK2019: unresolved external symbol "public: __thiscall FloatText::FloatText(void)" (??0FloatText@@QAE@XZ) referenced in function _WinMain@16<br />
main.obj : error LNK2019: unresolved external symbol "public: void __thiscall FloatText::SetText(char *)" (?SetText@FloatText@@QAEXPAD@Z) referenced in function "long __stdcall WindowProcedure(struct HWND__ *,unsigned int,unsigned int,long)" (?WindowProcedure@@YGJPAUHWND__@@IIJ@Z)<br />
So, what's going on if the code compilation runs normally???
thanks
|
|
|
|
|
the error came because you might havent implement the following functions
GetText
MoveText
FloatText
SetText
in the cpp file or the way u implement wasnt correct. Check whether you have implemented the fu nction as shown below
eg:
char* FloatText::GetText()<br />
{<br />
return ......;<br />
}
nave
|
|
|
|
|
Alex Cutovoi wrote: I implemented this class in a ".cpp" file
Where is this cpp file. Is it included in the project.
|
|
|
|
|
Did you declare body for functions on the FloatText.cpp
|
|
|
|
|
Problem solved guys, I include the files in my project with the option, right clicking in my project and selecting "Add Existing Item". And works fine.
thanks for the support
|
|
|
|
|
I glad you find it
|
|
|
|
|
Hello. I am very new to C++ programming so I hope someone could help me out. I am writing a program for a class in which you input your weight, height, and age, in inches, and it will output your waist size, jacket size, and hat size. The only problem is that for every two years over the age of 28, you have to adjust the waist size by adding 0.1 inch, and you can't add anything until a full two years have passed. This is my only problem in the code that I don't understand - the rest of the program works fine. If someone could help me out that would be great!!
|
|
|
|
|
So, you need to work out someone's age, in years, and then add floor((age-28)/2) * .1 to the wast size. This means you need to include math.h
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Assume an age of 0. In that case we have:
floor((0.0-28)/2)*.1
which equals floor(-28.0/2)*.1
which equals -14.0*.1
which equals -1.4
I think perhaps an additional check that the age is greater than 28 is needed.
Steve
|
|
|
|