|
Hi everyone, i have a wrapper calss of std::list<T> that compiles well under VC6.0 but under VC7.1 gegerates syntax error. the listings of the file are as follows:
.h file looks like this
template <class T> class myList
{
public:
list<T>::reference front();
protected:
list<T> m_lItems;
};
and .cpp file looks like this
template <class T> list<T>::reference myList<T>::back()
{
list<T>::reference r = m_lItems.back();
return r;
}
any help why this code is being compiled in VC6 but not in VC7.1.
the error it generated is
error C2143: syntax error : missing ';' before '<
Tariq
|
|
|
|
|
template class myList
{
public:
list::reference front();
protected:
list m_lItems;
};
and .cpp file looks like this
template list::reference myList::back()
{
list::reference r = m_lItems.back();
return r;
}
---------------------------------------------------------
Questions:
1) Where is the list?
You do not difine it (declare it) or what ever...
---------------------------------------------------------
Answer:
1) It is not there!
---------------------------------------------------------
How to declare a list class from a given template:
#include <list>typedef list<byte> CByteList;
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Well, the class declaration doesn't have a back() method, so that's an error. You also need to have the method's code in the header file, or you'll get linker errors. But to fix the error you posted about, remove the <T> as shown:
template <class T> list<T>::reference myList<s><T></s>::back()
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
|
|
|
|
|
This my first messege in my first day at this perfect site
I have a problem using the Friend Function in microsoft visual C++ .I have a multifile program contains statements like this
friend bool operator < (const tenant&, const tenant&);<br />
bool operator < (const tenant& t1, const tenant& t2)<br />
{ return t1.name < t2.name; }
compiler flags me errors like these:
error C2593: 'operator <' is ambiguous
error C2248: 'name' : cannot access private member declared in class 'tenant'
Can any one help me ..
please my friends.
Abuamr Alareefi
|
|
|
|
|
Well, I do not know if this helps at all but both the declaration refer to the same thing, I think, (no wonder the compiler upset).
//declaration in class tenant within a header file.
friend bool operator < (const tenant&, const tenant&); // friend to whom?
//definition in the source file.
bool operator < (const tenant& t1, const tenant& t2) // may not care
{ return t1.name < t2.name; }
I do not know the symantics, but this is wrong unless you know who your fiend is.
I'll assume, yor wrote the version:
//declaration in class tenant within a header file.
friend bool operator < (const tenant&, const tenant&); // friend to whom?
That should not be needed it the version:
//definition in the source file.
bool operator < (const tenant& t1, const tenant& t2) // may not care
{ return t1.name < t2.name; }
Already exists.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
got a problem in the following code
void main()
{
IGraphBuilder *pGraph = NULL;
IMediaControl *pControl = NULL;
IMediaEvent *pEvent = NULL;
// Initialize the COM library.
HRESULT hr = CoInitialize(NULL);
if (FAILED(hr))
{
printf("ERROR - Could not initialize COM library");
return;
}
// Create the filter graph manager and query for interfaces.
hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, (void **)&pGraph);
if (FAILED(hr))
{
printf("ERROR - Could not create the Filter Graph Manager.");
return;
}
hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
hr = pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);
// Build the graph. IMPORTANT: Change this string to a file on your system.
hr = pGraph->RenderFile(L"C:\\Example.avi", NULL);
if (SUCCEEDED(hr))
{
// Run the graph.
hr = pControl->Run();
if (SUCCEEDED(hr))
{
// Wait for completion.
long evCode;
pEvent->WaitForCompletion(INFINITE, &evCode);
// Note: Do not use INFINITE in a real application, because it
// can block indefinitely.
}
}
pControl->Release();
pEvent->Release();
pGraph->Release();
CoUninitialize();
}
the compliler says, "Unresolved externals;
CLSID_FilterGraph
IID_IMediaEvent
IID_IMediaControl
IID_IGraphBuilder
mir
|
|
|
|
|
I assume you included something like dshow.h or your code wouldn't have compiled. Try including thoe header files that define those guids in a single source file in your project like this:
Assume this were a file called guids.cpp in you project.
#include <initguid.h>
#include <dshow.h>
#include <uuids.h> // or maybe just include these instead of dshow.h
#include <control.h>
|
|
|
|
|
Sorry about that <'s got treated as html tags.
I assume you included something like dshow.h or your code wouldn't have compiled. Try including thoe header files that define those guids in a single source file in your project like this:
Assume this were a file called guids.cpp in you project.
#include <initguid.h>
#include <dshow.h>
#include <uuids.h> // or maybe just include these instead of dshow.h
#include <control.h>
|
|
|
|
|
How to insert bmp,jpeg images to a button control from a file.
Sreeja
|
|
|
|
|
can u be more specific.....
i mean do u want to load this dynamically??(that is when the program is runnning)
or is that u already have a file that u want to put into the button before running the program.....
if it is the latter.....
use this.....
myButton.SetBitmap( ::LoadBitmap(NULL, MAKEINTRESOURCE(OBM_CHECK)) );
therz a lot of documentation in the msdn.....search in Cbutton
hope that helpz.....
happy programmin.....
cheerz.....
|
|
|
|
|
I want to download a file with an https url which requires authentication. Obviously doing this with an internet browser works but I have to supply the username and password in a popup authentication dialog. I am able to download files using plain old http without authentication by using the following API's:
HINTERNET h=InternetOpen("Session Name", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
HINTERNET h2=InternetOpenUrl(h, "http://....", NULL, 0, 0, NULL);
char buf[2048];
DWORD dwRead;
InternetRead(h2, buf, 2048, &dwRead);
I tried using InternetOpen() then InternetConnect() because connect too username/password parameters but I guess I must be missing something after that because the InternetRead doesn't work. I think I need to send and Http request but I'm not sure what or how.
|
|
|
|
|
|
That's really close to what I need. My problem is still how to do the authentication.
|
|
|
|
|
I am developing a simple TAPI control , that simply needs to connect via modem. No problem? Well, it works, but it does not seem to be getting the dialing information. What I mean is that if it requires a 9 to get an outside line, it is does not know it. I did not think lineTranslateAddress(...) would do it (I'll need that later), but I tried it and all it did was insert a T in front of the the number I entered.
Note: T -> Dial number as typed, do not modify it.
Does anyone know if this is normal?
Buy normal , I mean I am checking the setup on the customers machine (in house development) tomorrow to see if that is the problem. If not, what TIPI settings (funcion call) do I need to make, in order to for it to get the information (this should be automatic).
Basicaly, if the customer has to enter the number as T9,876-54321 instead of simply typing 87654321, we have a problem.
Thanks for any insights you may have.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Where you customer Entering the Number--
if it in EditBox,then check the string produce after entering for illegal charaters like { , - # ) .
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
ThatsAlok wrote:
Where you customer Entering the Number
No (and Yes), I am the developer!
The number entered into the EditBox is correct (in test program as well as final program). The number dialed is correct. Given that, TAPI via provider (the system, whatever) is supposted to figure out the rest. If I was to type 9876541 then the system is supposted to know that it is an outside line and convert it to T9,987-6543, but it does not. If I dialed T217, then it would take that litteraly and call an inhouse number (internal phone/station). The information for accessing outside lines is setup via the Windows control panel and Windows tapi32 should be using that information, to determine how to dial the number. I should not have to know what register keys to look at, or any thing like that.
Oh, by the way ",-" are legal characters, I have not check if '#' is illegal or not. The spaces you put between them (for seperators) may also be legal, I may check to find out.
"," -> pause (provider-difined deration)
"-" -> not sure, but may cause a pause also.
At the very least, even if the control panel is not set up to dial an outside line, I was expecting lineTranslateAddress(...) to conver the number to T987-6541 instead of T9876541.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
I am Missing Some Important Information About TAPI.
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Anyonw knows why? If i take the code into c++ builder, the loadlibrary will work just fine...IF i enable dynamic RTL (ryntime library).
I can load any dll:s except the one i have made. I created the DLL through the wizard in c++ net, although it won't work. The error code from GetLastError after the LoadLibrary call is 6 (The handle is invalid.). Which handle?
Stefan
|
|
|
|
|
Can you run DEPENDS on the DLL and see what it needs? Often that helps.
It may be that it's trying to load another DLL like a runtime library that's not there.
Steve S
Developer for hire
|
|
|
|
|
Where do I find DEPEND? And how do I use it. Never used it before.
|
|
|
|
|
Found it =)
The dll loads the following modules: kernel32, msvcrt71.dll, ntdll.dll
I have no use for the msvcrt71.dll. How do I remove it? As far as I know, i use no functions from that lib. This might be the problem.
Ideas anyone?
|
|
|
|
|
Hi All,
I have a very complex dialog with 5 edit controls,4 comboboxes,3 radio buttons and 2 list boxes.
The controls id's are not in sequence(hence i cannot use ON_CONTROL_RANGE).I need to write a handler which will be called whenever user makes any changes to any of the controls.Is there any way to do this without adding an event handler for individual controls.
Thanks in advance,
Raghu
|
|
|
|
|
That is not a complex dialog!
If you want to centralise (create a handler) the control of any change messages, then you write one function that can handle any change and have have all the the change messages rerouted to that handler. What that means is that you have your on-change functions for each control call the same function to handle the message.
On a more practical note; each on-change function should do it's own thing and then call a funcion that, that says "wow, something has changed so we have to update the current status" (display, whatever...) and act accordingly.
Of course you could write a hook, to handle the messages, but that is a more than a bit of overkill for simple message handling.
You could also handle the messages in PreTranslateMessage(...), which is almost the same as writing your code in C (one message handler for the whole window).
Those are the choices I see, but essentualy what you appear to need is just a function that needs to be called it any changed occured. (See "On a more practical note")
Good Luck!
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
What is the most common language used for programing mobile games?
dee
|
|
|
|
|
i Think J2ME & BREW
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|