|
sorry - it is a 'using namespace minsk;'
(was a typo in the original post...)
Flirt harder, I'm a coder.
mlog || Agile Programming | doxygen
|
|
|
|
|
In the edited version you should not need this line as it is redundant:
using minsk::f;
Is the function f() defined in any other namespace or the global namespace?
John
|
|
|
|
|
John M. Drescher wrote:
Is the function f() defined in any other namespace or the global namespace?
No
(I made an "empty" Windows console application to test that)
The problem occurs only if both using statements are there - but unfortunately, I almost can't avoid that.
it's amout std::min and std::max
I've got a library that tries to override the #define min / max in windef.h by using #defining NOMINMAX and using std::min; using std::max
This works well - until there's a .cpp (or a function) that a) says using namespace std and b) uses min and/or max
Flirt harder, I'm a coder.
mlog || Agile Programming | doxygen
|
|
|
|
|
|
m mistake it is a 'using namespace minsk;'
(so VC seems to see two "paths" to the function)
Flirt harder, I'm a coder.
mlog || Agile Programming | doxygen
|
|
|
|
|
Hi peterchen, from what you said this arose in connection with redefining std::min and std::max . Does this very example also fail? I mean, does the program
namespace minsk{
void f(){}
}
using minsk::f;
using namespace misk;
void bar(){
f();
}
int main()
{
bar();
return 0;
} fail? (I cannot check it myself, don't have my IDE handy.)
Also, could you post the entire error message?
PS. The semicolon after the closing namespace brace is unnecesary.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
yep, it fails. Error Message is
error C2668: 'f' : ambiguous call to overloaded function
I used an Windows Console Application / Empty Project, added a single .cpp and the following code:
namespace minsk
{
void f();
};
using minsk::f;
using namespace minsk;
int main()
{
f();
return 0;
}
so there is just this, nothing else (and standard project settings).
I can work around my problem for the current build environment, just it would be good to know if this is "normal" or just a VC6 bug
Flirt harder, I'm a coder.
mlog || Agile Programming | doxygen
|
|
|
|
|
I'm almost certain this is a VC6 bug. I can check tomorrow.
Meanwhile, the following workaround may prove good for you (although tou said you already had a solution):
namespace minsk
{
void f(){}
}
#ifdef f
#undef f
#endif
#define f ::minsk::f
using namespace minsk; Good luck!
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
How can I get the date stamp of my running executable?
Ray
|
|
|
|
|
GetModuleFilename()
CFile::GetStatus()
- Examine the
m_ctime member /ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I use the date stamp of my executable as the version number, which I append to the title of my main window. Here's how I get the info:
static char appVersion[30];<br />
<br />
void AteUtility_InitAppVersion (HINSTANCE hInstance)<br />
{<br />
char szFileName[MAX_PATH];<br />
char szFileTitle[MAX_PATH];<br />
WIN32_FIND_DATA fileData;<br />
FILETIME localModTime;<br />
SYSTEMTIME systemTime;<br />
<br />
GetModuleFileName (hInstance, szFileName, MAX_PATH);<br />
<br />
GetFileTitle (szFileName, szFileTitle, MAX_PATH);<br />
<br />
FindFirstFile (szFileName, &fileData);<br />
<br />
FileTimeToLocalFileTime (&fileData.ftLastWriteTime, &localModTime);<br />
FileTimeToSystemTime (&localModTime, &systemTime);<br />
<br />
sprintf(appVersion, "Version: %4.4d.%2.2d.%2.2d.%2.2d.%2.2d", systemTime.wYear, systemTime.wMonth, systemTime.wDay, systemTime.wHour, systemTime.wMinute);<br />
}
Hope this helps!
'til next we type...
HAVE FUN!! -- Jesse
|
|
|
|
|
I got this error of cv.lib not being able to open
What should i open the lib with?
Thanks
|
|
|
|
|
I can only guess, but it sounds like either the "cv.lib" doesn't exist,
means you don't have the library, or the path to the lib is not correct.
Perhaps you copied the sources from another machine and now Visual Studio
doesn't find the lib anymore.
Search your disk for the lib and enter the path to it... and everything
should work fine.
Regards, mYkel
|
|
|
|
|
Hello,
I have a MDI application with only one type of document template.. I would like to open a new/blank document but I dont want the new document to be shown in front of the currently open doc. Basically open it behind any previously open docs... Anyone know any tricks around this?
Right now I am using OpenDocumentFile(NULL), this brings the new doc to the front (as designed).
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
MDI will always put the active child window on top. If you don't want it to be active (have focus) then after you open it make you real document the active window again.
That said having a "new" window behind the current window sounds very strange for the poor user.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
Thanks, right after the post I setup a function to do just that.
The MDI app is a tabbed chat client, when a new person msg's the user I didn't want the new tab/doc to pop-up in front especially if the user was in the middle of typing to someone else....
Anyway thanks for your help,
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
char lpBuffer[256];
GetPrivateProfileString()
"FYP", // LPCTSTR lpAppName
"MyKey1", // LPCTSTR lpKeyName
"0", // LPCTSTR lpDefault - in case file does not exist this is default
lpBuffer, // LPCTSTR lpReturnedString
256, // DWORD nSize
"File.ini" // LPCTSTR lpFileName
);
WritePrivateProfileString()
"FYP", // LPCTSTR lpAppName
"MyKey1", // LPCTSTR lpKeyName
"0", // LPCTSTR lpString - whatever you want to save
"File.ini" // LPCTSTR lpFileName
);
Can someone explain to me how to go about using this privateprofilestring
|
|
|
|
|
You have to specify the full path to the file.
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|
char lpBuffer[256];
GetPrivateProfileString()
"c:\Desktop\FYP", // LPCTSTR lpAppName
"MyKey1", // LPCTSTR lpKeyName
"0", // LPCTSTR lpDefault - in case file does not exist this is default
lpBuffer, // LPCTSTR lpReturnedString
256, // DWORD nSize
"File.ini" // LPCTSTR lpFileName
);
WritePrivateProfileString()
"FYP", // LPCTSTR lpAppName
"MyKey1", // LPCTSTR lpKeyName
"0", // LPCTSTR lpString - whatever you want to save
"File.ini" // LPCTSTR lpFileName
);
You mean like this?
|
|
|
|
|
No, the last parameter must contain a full path to your file.
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|
ic..u mean FYP.doc?
Then do i need to declare variable in the GetPrivateProfileString()function?
Then what do i key in for "MyKey1"?
GetPrivateProfileString()
"c:\Desktop\FYP", // LPCTSTR lpAppName
"MyKey1", // LPCTSTR lpKeyName
"0", // LPCTSTR lpDefault - in case file does not exist this is default
lpBuffer, // LPCTSTR lpReturnedString
256, // DWORD nSize
"File.ini" // LPCTSTR lpFileName
);
Thanks alot
|
|
|
|
|
I think he means File.ini should be c:\Desktop\FYP\File.ini or what ever your path is.
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
char* lpFullPath = "C:\\Program Files\\MyProgram\\File.ini";
GetPrivateProfileString("MYAPPNAME", "MyKey", "error", lpBuffer, 256, lpFullPath);
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|
#include "stdafx.h"
char lpBuffer[256]
{
GetPrivateProfileString("MYAPPNAME", "MyKey1", "error", lpBuffer, 256, C:/Desktop/FYP.ini)
"MYAPPNAME", // LPCTSTR lpAppName
"MyKey", // LPCTSTR lpKeyName
"0", // LPCTSTR lpDefault - in case file does not exist this is default
lpBuffer, // LPCTSTR lpReturnedString
256, // DWORD nSize
"C:/Desktop/FYP.ini" // LPCTSTR lpFileName
WritePrivateProfileString(("MYAPPNAME", "MyKey1", "error", lpBuffer, 256, C:/Desktop/FYP.ini)
"MYAPPNAME", // LPCTSTR lpAppName
"MyKey1", // LPCTSTR lpKeyName
"0", // LPCTSTR lpString - whatever you want to save
"C:/Desktop/FYP.ini"// LPCTSTR lpFileName
}
return 0;
Is this programme correct now?
Do I leave MYAPPNAME as it is?
|
|
|
|
|
void MyFunction()
{
char lpBuffer[256];
GetPrivateProfileString("MYAPPNAME", "MyKey1", "error", lpBuffer, 256, C:/Desktop/FYP.ini);
WritePrivateProfileString(("MYAPPNAME", "MyKey1", "error", lpBuffer, 256, C:/Desktop/FYP.ini);
}
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|