|
Are you importing System and System.Threading in the location that the Mutex is used? Basically you are using a Mutex object in some form or another but you are not properly importing the libraries that provide the underlying code for it. This is what MSDN says:
Linker Tools Error LNK2020
Similar to an undefined external error, except that the reference is via metadata.
To resolve:
Define the missing function or data, or
Include the object file or library in which the missing function or data is already defined.
|
|
|
|
|
For my librairie, i used the new Class Library (.NET) project in vs.net 2003.
Maybe the error come from there.
I just add id3libD.lib to the linker's options and include <id3 tag.h=""> and <sstream>. My class inherit from ID3_Tag but except that i just use things like int, string, stringstream and char*.
I (tried to) read that thing:
msdn
In fact when you start a new Class Library (.NET), you automatically have a project that is all ready designed (i can't choose an empty project). And automatically you have this declaration for the class:
public __gc class Class1
And it seems to have a link with mutex. I was constrained to erase public __gc in the previous declaration because of my class inherit from ID3_Tag which is not a __gc class.
But that's all i found. So i supose that the project pre-configuration make that it expects a __gc class. But it is just a suposition and i don't know what to do.
P.S: After others tests, it appear that it is the std::stringstream which cause the error. What library is missing?
|
|
|
|
|
Does anyone know the "student's distribution probability function"? I have found several examples online but they are not easily interpreted to C++ source code (actually they are impossible to interpret...at least the ones I have found so far). I basically need to have a function that I pass in the degrees of freedom and the significance level and have it return the significant probability level such that I can compare it to results I have and determine if my results are indeed significant or not. (This function appears to compute a point on a Gaussian curve where anything in the middle is considered insignificant and anything outside is considered significant.)
You can find tons of precalculate charts for this, but not the actual formula. So for example: Say I have calculated the correlation coefficient for a vector of size 10 and I want to determine if my results are significant for a 0.05 (i.e. 95% or greater) significance level (which according to the tables would be 0.55 or greater). So I need a function that would be:
0.55 [Significant Probability Level] = ProbabilityFunction(10 [degrees of freedom], 0.05 [Significance Level]);
I realize this is probably not the normal types of questions people here post/answer...but for anyone wanting a challenge (or happens to already have this source code) and would be nice enough to reply...I would greatly appreciate their efforts. Thanks!!
|
|
|
|
|
I am using Ivor Horton's "Beginning Visual C++" to learn Visual C++. When compiling one of the exercise programs, I get 4 errors, which are
"c:\program files\microsoft visual studio\vc98\include\zmouse.h(138) : error C2146: syntax error : missing ';' before identifier 'HwndMSWheel'"
c:\program files\microsoft visual studio\vc98\include\zmouse.h(138) : error C2433: 'HWND' : 'inline' not permitted on data declarations
c:\program files\microsoft visual studio\vc98\include\zmouse.h(138) : error C2501: 'HWND' : missing storage-class or type specifiers
and finally -
c:\program files\microsoft visual studio\vc98\include\zmouse.h(138) : fatal error C1004: unexpected end of file found.
Does anyone know what I am doing wrong? The code has no reference to zmouse.h only one include, #include <afxwin.h>. I tried using #include "stdafx.h" instead since that had worked on an earlier example, but I still get the same errors.
Does anyone know what I am doing wrong?
|
|
|
|
|
That header has a function - HwndMSWheel() - that's using Win32 elements like HWND and FindWindow() . Is your app a GUI app and including the Windows headers?
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Shots do not hurt other players... yet
|
|
|
|
|
It is a GUI app, but the only include is #include <afxwin.h>. Since it is a short piece of code, I'll paste it here.
// EX13_01.CPP
// An elementary MFC program
#include <afxwin.h> // For the class library
//#include "stdafx.h"
// Application class definition
class COurApp:public CWinApp
{
public:
virtual BOOL InitInstance();
};
//Window class definition
class COurWnd:public CFrameWnd
{
public:
// Class constructor
COurWnd()
{
Create(o, "Our Dumb MFC Application");
}
};
// Function to create an instance of the main window
BOOL COurApp::InitInstance(void)
{
// Construct a window object in the free store
m_pMainWnd = new COurWnd;
m_pMainWnd->ShowWindow(m_nCmdShow); // .. and display it
return TRUE;
}
// Application object definition at global scope
COurApp AnApplication; // Define an application object
|
|
|
|
|
|
He hasn't - he has not checked 'Do not treat <'s as HTML tags'
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
BlackDice wrote:
I didn't think you could write a blank #include without specifying what you're including.
It's <afxwin.h> .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
My bad, somehow when I copied the code to the message board, I left off "afxwin.h". May have happened because it left the "<>" around it.
|
|
|
|
|
PapermillBill wrote:
I tried using #include "stdafx.h" instead since that had worked on an earlier example, but I still get the same errors.
Does your app have a stdafx.h ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
No, only when I put it in as an include instead of afxwin.
|
|
|
|
|
Well, why include it if it's not there ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Why innclude what if it's not there? I'm not sure I understand the question.
The original had #include <afxwin.h> and I got the compile error I quoted. I commented out that line and used #include "stdafx.h" instead since I had successfully used that before, but the result was the same.
|
|
|
|
|
PapermillBill wrote:
The original had #include <afxwin.h&gyt; and I got the compile error I quoted. I commented out that line and used #include "stdafx.h" instead since I had successfully used that before, but the result was the same.
I have to say, it sounds to me like you have no idea what #include does. Changing lines at random is not how you should code. Go and buy a very basic C++ book and read it before you open your compiler again.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian, I'm very sorry to have bothered you. I do have a VERY basic book for Visual C++, one by Ivor Horton, and I understand what #include does. I have successfully written many programs in VAX C, and several Win console apps.
But now I need to learn how to use GUI's in Windows apps. I can't find anyone who knows what might be causing the error so I was trying a different header file to see if I could determine where the error was coming from. I found the error listed in "known problems" but the solution said to include windows.h before zmouse.h in your code. Since I'm not using windows.h that didn't help. From my reading I understand that windows.h was used with much earlier versions of C++.
I certainly didn't mean to waste your time. I will try to find someone who has more time to lend a person trying to learn and perhaps has knowledge of this particular type of problem. Please accept my appologies for any inconvience I have caused you. From the disdainful tone of your message I assume as a novice that I have abused this message board and I appologize to any other users for doing so. It won't happen again.
|
|
|
|
|
windows.h contains all the headers for windows application development. In fact, from memory, it's a header full of #includes.
PapermillBill wrote:
From the disdainful tone of your message I assume as a novice that I have abused this message board and I appologize to any other users for doing so. It won't happen again.
Dude, don't get offended. It's just a wierd thing for you to do, to try and #include something that's not there. I hope you find your solution. Why don't you email me the project if you're still stuck and I'll look at it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
When I try to create a modeless dialog (according to the example given by Dr. GUI on MSDN) with the CDialog::Create() function it gives a casting error message when I use the following where 'CParams' is a dialog's class:
CParams *m_pParams;
m_pParams = new CParams;
---> m_pParams->Create(IDD_DIALOG1, this);
m_pParams->ShowWindow(SW_SHOW);
This is the error in visual c++ 6:
error C2664: 'int __thiscall CDialog::Create(const char *,class CWnd *)' : cannot convert parameter 1 from 'const int' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Please help. I'm trying to create a modeless dialog here.
Thanx
|
|
|
|
|
Put the call to Create() in the dialog's constructor like:
CParams::CParams()
{
Create(IDD);
}
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hello TEOlivier,
Try this code,
CParams *m_pParams;
m_pParams = new CParams(this);
m_pParams->Create(CParams::IDD);
m_pParams->ShowWindow(SW_SHOW);
I assumed that CParams is the name of your dialog's class.
Regards
|
|
|
|
|
// Load xml file.
if (pDocument->load(myxmlfile)!= VARIANT_TRUE)
The above line of code will load an xml file. myxmlfile is supposed to be the path of the xml file. However it is a string. The load function takes
a _bstr_t. What is the appropriate way to handle this. Should i cast, is there a better way to handle than type casting?
|
|
|
|
|
pDocument->load(&myxmlfile) seems to work.
Anyone know why?
|
|
|
|
|
|
Is there any way to determine if a wchar_t is a valid UNICODE character?
Requirement: Standared C++, only.
I can easily determine if a character is of a particular type, but I don't need to know the type.
What I need to know is the valid ranges.
Example:
Given a range [c1-c2] of characters; where c1 and c2 are of type wchar_t and may or may not be in the same charater class. The only requirement is that they are consecutive from c1 to c2.
There is an article in MSDN, "Character Match Sets", that describes the ranges in the Unicode Standard, but when comparing them to actual Unicode character sets, they don't seem to match up.
I've been looking for a standared function in the form "int isvalid(wchar_t);", but there does not seem to be one.
My only opptions seem to be:
1) Write my own, that calls all character class specific function.
2) Write my own using iswctype(), specifing all possible flags (See (1) above).
Neither of these realy give me the range, but only provides a means of validating most characters, after the between characters have been generated.
Thanks!
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Hi,
I have a situation where I am communicating with a USB device (based off the FT232 usb chip by ftdi) where it will go into a hanged state when subjected to certain conditions such as large transients on the line. None of the reset device or cycle port commands that come with the driver work to bring it out of this state.
I was wondering if it is possible to reset the hub or port the device is connected to in user-mode software? Can I get the symbolic name of the hub, open it, and pass it a certain IOCTL code through DeviceIoControl() that would do this?
Any help or links to relevant information would be greatly appreciated. Thank you.
Jay
jay@bellsouth.net
|
|
|
|