|
I have compiled the libtorrent library in an Visual Studio 2008 mfc dll project. I want to use this dll via an import library in a managed exe console application also developed in VS 2008.
The managed application project compiles ok. But when I try to run it I get the following assertion failed error message:
Debug Assertion Failed!
File: F:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\dllinit.cpp
Line: 587
And when I press ignore I get the the following assertion failed error message
Debug Assertion Failed!
File: F:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\dllmodul.cpp
Line: 137
After I press again the application works fine.
Althogh the path for the above files is not correct these files do exist in the following folder on my system
C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\src\mfc
The following line in dllinit.cpp is cuasing the first assertion failiure:
ASSERT(AfxGetModuleState() != AfxGetAppModuleState());
And the following line in dllmodul.cpp is cuasing the second assertion failure:
VERIFY(AfxSetModuleState(AfxGetThreadState()->m_pPrevModuleState) ==
&afxModuleState);
Can any one help me out as to why these assertion failures are ocurring and how to resolve them?
|
|
|
|
|
Hi,
I'm having the same problem. Do you have found a solution by any chance ?
|
|
|
|
|
The bug has nothing to do with unmanage or managed interoperatability. The bug is somewhere in the Libtorrent Library but I cant seem to find the place of error.
|
|
|
|
|
Hey, I am trying to open form2 from form1. Then open a new form1 when form2 is closed. But adding the #include "Form1.h" header to form2.h is causing errors (undeclared identifier). I added these inclusion guards and tried using forward declaration. EIther that didn't work or I used it wrong, not sure I followed the correct syntax since all of the code is in the header files - the automatically generated code for Forms and controls.
/*Form1.h*/
#pragma once
#ifndef First
#define First
#include "Form2.h"
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
Form2 ^ frm = gcnew Form2;
frm->Show();
this->Close();
}
#endif
/*Form2.h*/
#pragma once
#ifndef Second
#define Second
#include "Form1.h"
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
Form1 ^ frm = gcnew Form1;
frm->Show();
this->Close();
}
#endif
|
|
|
|
|
Your post is wrong on so many levels it's difficult to know where to start.
First, it is obvious you are a beginner. I don't know of any authoritative source for this but common sense tells me that Managed C++ development is not appropriate for beginners. Beginners probably need to learn C/C++ basics and consider CLI an advanced topic.
Next, as a user, if an application is popping up windows all the time I am closing it and uninstalling it. There is absolutely no need to open up new top level windows just to display a different view. Tabs are also grossly abused, from an MDI or Configuration perspective they make sense, but not as a Primary UI design.
Another thing, if you insist on this insanely poor path, the fundamental solution to a circular dependency problem is to introduce a third item to the picture and define the relationships such that the original two items are unrelated.
item one item two
\ /
\ /
\ /
new item
One other thing, you might want to start learning what Software Design Patterns are.
Good luck
modified on Tuesday, March 24, 2009 1:01 PM
|
|
|
|
|
Wow, talk about confused. For someone who doesn't know the answer you sure have a lot to say. Clearly, you misunderstand an attempt to simplify an example. As such you should consider not "answering" (loosely used, in your case) to people's posts.
|
|
|
|
|
thenutz72 wrote: Wow, talk about confused.
Ok, let's talk about that. What are you confused about?
thenutz72 wrote: For someone who doesn't know the answer
Um, "the answer"? Really, there is only one way to solve your problem, interesting. What part of my post does not qualify as an answer?
thenutz72 wrote: you should consider not "answering"
First lets get one thing clear. So far there is not one thing you have said that I would consider let alone that suggestion.
By the way if you continue to attempt to berate my reply it will end with me ripping your virtual head off and shoving it down your ignorant throat.
|
|
|
|
|
|
|
Mike is a well known here and has helpled lots of people, I suggeset you take what he has said constructively.
|
|
|
|
|
if you are creating a windows form application under CLR category then in Form1.h your code must be like this:
#pragma once
#include "Form2.h"
namespace CircularForm {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
.
.
.
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
Form2^ f2 = gcnew Form2();
f2->Show();
this->Close();
}
but when the form1 is closed the managed memory of form2 will be released. the whole program will be ended.
there is 2 way to do this:
1. don't close the form1, just hide form1 and when form2 is closed show it(form1) again.
2. add a new class (Form3) containing two objects (Form1 f1, Form2 f2). set it as startup form and control the f1,f2
sometimes 0 can be 1
|
|
|
|
|
Hi all,
Please help me to solve below problem:
1. First, I develop a 32bit application (include C#, VB, C++/CLI, C) in Vista 64bit with .NET framework 3.5, VS 2008. Everything runs ok.
a. C++/CLI, C: platform is Win32
b. C#, VB: platform is x86
2. Second, I continue convert above application to 64bit application and also run in Vista 64bit, .NET 3.5, VS 2008.
To converting, I change some main point as below:
a. C++/CLI: change platform from Win32 to x64, and pointer from 4bytes to 8bytes
b. C#, VB: change platform from x86 to Any CPU.
Everything builds ok, but when run application, unhandled exception was thrown everytime it call constructor of C++/CLI object:
- Message: "System.IO.FileNotFoundException: The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
- Stack Trace: " at ProjCS.Form1..ctor()
at ProjCS.Program.Main() in N:\test\Test64\ProjCS\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()"
I try to re-install VS 2008 and googling but still cannot find solution.
Anyone who has experience about problem, please help me to find root cause and solution to solve it.
Thanks a lot.
|
|
|
|
|
Hi everybody,
Please take you time to help me. Currently, I must solve it as soon as possible!
|
|
|
|
|
I want to write an event which is triggered when a file is created in a particular directory and then do rest of things.
Naveen
|
|
|
|
|
|
Hello folks,
Can someone help me with this question: How can I make this work?
<br />
#include "stdafx.h"<br />
using namespace System;<br />
<br />
public ref class classX<br />
{<br />
private:<br />
classY ^m_refClassY;<br />
<br />
public:<br />
classX()<br />
{<br />
this->m_refClassY = gcnew classY();<br />
}<br />
};<br />
<br />
public ref class classY<br />
{<br />
private:<br />
classX ^m_refClassX;<br />
public:<br />
classY()<br />
{<br />
this->m_refClassX = gcnew classX();<br />
}<br />
};<br />
<br />
int main(array<System::String ^> ^args)<br />
{<br />
Console::WriteLine(L"Hello World");<br />
return 0;<br />
}<br />
Always when I try to compile this source, this error comes up.
cross_reference.cpp(10) : error C2143: syntax error : missing ';' before '^'
cross_reference.cpp(10) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
cross_reference.cpp(10) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
cross_reference.cpp(15) : error C2039: 'm_refClassY' : is not a member of 'classX'
cross_reference.cpp(8) : see declaration of 'classX'
cross_reference.cpp(15) : error C2061: syntax error : identifier 'classY'
|
|
|
|
|
Forward declaration is the solution for circular dependencies. See the corrected code
ref class classY;
public ref class classX
{
private:
classY ^m_refClassY;
public:
classX();
};
public ref class classY
{
private:
classX ^m_refClassX;
public:
classY();
};
classX::classX(){
this->m_refClassY = gcnew classY();
}
classY::classY(){
this->m_refClassX = gcnew classX();
} In a real application, try to move the classes into separate files.
|
|
|
|
|
In fact, my real source is in separate files, but I got the same problem.
Anyway, with your answer I figured out what to do in this case too.
Thanks.
|
|
|
|
|
Navaneeth (or anyone ,
I posted this under "Circular Form Reference" subject but it's a very similar question. I had tried to add 'ref class Form2;' but now get a 'no appropriate default constructor available'.
I was able to recreate my issue by simply creating two forms and adding a button to each that call the other form. So most of the code is the automaticly generated code from MS. I'm trying to keep the example simple by only incl. some code.
/*Form1.h*/
#pragma once
#ifndef First
#define First
#include "Form2.h"
ref class Form2;
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
Form2 ^ frm = gcnew Form2;
frm->Show();
this->Close();
}
#endif
/*Form2.h*/
#pragma once
#ifndef Second
#define Second
#include "Form1.h"
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
Form1 ^ frm = gcnew Form1;
frm->Show();
this->Close();
}
#endif
modified on Tuesday, March 24, 2009 1:30 PM
|
|
|
|
|
You'll probably need to separate your code out of the H files into CPP files for
at least one of your classes.
#pragma once
ref class Form2;
ref class Form1 : public System::Windows::Forms::Form
{
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e);
}
#include "Form1.h"
#include "Form2.h"
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
Form2 ^ frm = gcnew Form2;
frm->Show();
this->Close();
}
#pragma once
#include "Form1.h"
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
Form1 ^ frm = gcnew Form1;
frm->Show();
this->Close();
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
To do what do you want, you´ll have to do forward declaration, in the same way explained by Navaneeth.
<br />
<br />
#pragma once<br />
ref class Form2;
<br />
<br />
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e);<br />
<br />
<br />
#include "Form1.h"<br />
#include "Form2.h"
<br />
System::Void Form1::button1_Click(System::Object^ sender, System::EventArgs^ e)<br />
{<br />
Form2 ^ frm = gcnew Form2;<br />
frm->Show();<br />
this->Close();<br />
}<br />
<br />
<br />
<br />
#pragma once<br />
#include "Form1.h"
<br />
<br />
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) <br />
{<br />
Form1 ^ frm = gcnew Form1;<br />
frm->Show();<br />
this->Close();<br />
}<br />
|
|
|
|
|
Hello all,
I create a monitor application that can sent email when trigger the alarm. But the McAfee block all the email by the rule "Prevent mass mailing worms from sending mail". Is there any way to create a customized rule or add my application into the exculde list when install it?
|
|
|
|
|
hi guys,
i am working on a worm scanner... most of the modules are done... but there is a problem regarding the pause button.. i not sure how to do it...
below is my coding :-
vector<wstring> files;
wstring directory =(L"C:\\Windows\\system32");
if (ListFiles(directory, L"*", files))
{
for (vector<wstring>::iterator it = files.begin(); it != files.end(); ++it)
{
keepname = WStringToString(it->c_str());
searchkmp();
int index = listBox1->Items->Add(String::Concat(gcnew String(it->c_str())));
listBox1->SelectedIndex = index;
count++;
listBox1->Update();
}
}</wstring></wstring>
when user click on start the program will get the filenames... each time it gets the filename it will call for the string matching function (searchkmp()) to match the for signature...
My question is how can i make a pause function in this program ya.. when user click on the pause the program should pause and when user click back on the same button it will continue....
kindly help me ya...
regards,
Thilek
|
|
|
|
|
I don't see anything in your post indicating a Managed C++/CLI question.
kindly help me ya...
Thilek wrote: My question is how can i make a pause function
Pausing and resuming threads might not seem as straight forward as you might think. It might interest you to know that older .NET frameworks had Thread.Pause/Resume but they were deprecated due to numerous problems (ok mostly user created problems). There are many resources you can read, you might start here[^]
Of course you don't actually have to pause/resume the threads because you can build into your system the functionality yourself. Meaning that you would upon your pause event actually stop the threads (gracefully of course) and then restart them on the resume event. This of course requires much work on your part.
modified on Monday, March 23, 2009 11:59 AM
|
|
|
|
|
well i am doing this program in .net... the entire program is done in managed C++ but there are some i had to use normal c++ since i am new to managed c++...
|
|
|
|