|
My little application was compiling fine as is until I installed the VS2008 SP1 yesterday. I mean it compiled fine, then I installed the update, then I recompiled and started getting the following error:
1>------ Build started: Project: GTRNoteWorker, Configuration: Release Win32 ------
1>Compiling...
1>GTRNoteWorker.cpp
1>Automatically linking with ToolkitPro1321vc90S.lib
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xtr1common(252) : error C2766: explicit specialization; 'std::tr1::_Is_integral<int>' has already been defined
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xtr1common(200) : see previous definition of '_Is_integral<int>'
1>Build log was saved at "file://c:\Coding\GTRNoteWorker - 2008\x86\Release\BuildLog.htm"
1>GTRNoteWorker - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
So I think OK, they tightened up something, so I checked to make sure I haven't included the header somewhere else ...then I realized that the error is stating that the thing has been defined already IN THE SAME HEADER file!
I think I must be missing a define or something
Any help would be appreciated!
Thanks,
Paul
|
|
|
|
|
You could prevent a header file from being included twice with a simple check:
#ifndef MYHEADER_H
#define MYHEADER_H
#endif
If this doesn't help, the error is indeed in the header content itself rather than a result of counting it twice. To give any assistance with that, you'll have to post it here
modified 13-Sep-18 21:01pm.
|
|
|
|
|
Hi, Thanks for your suggestion!
The header file is rather large and is part of VC9, C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xtr1common.h. After doing a Google search, I see that MS implemented a new specification in SP1 and a lot of people are getting these "explicit specialization" messages. I won't call them errors since I probably am missing something, however I'm just going to uninstall VS2008 and re-install it without SP1. At least the application could be compiled, and run before SP1 ...I just don't have time to track this down or learn the new requirements at this point.
Thank you again,
Paul
|
|
|
|
|
Well, I finally tracked it down. It makes NO sense to me but after I changed the order of the header files, I got an error specifying there was not enough memory to compile the resources - the message suggested using the /Zmxxx option which I did. This got me passed the errors and such. I did get another unrelated error at the step of embedding the manifest file: Mt.exe not found. I searched for the exe and it was not in the bin folder (where I assumed it was before installing SP1) sooo - I pointed the search path to use VS2005's MT.EXE. What a mess, but it compiles and runs now!
|
|
|
|
|
Gee, what do you know - There's an update MS patch to fix VS2008 SP1
|
|
|
|
|
Good to know
modified 13-Sep-18 21:01pm.
|
|
|
|
|
which one ?
Watched code never compiles.
|
|
|
|
|
|
I was caught out by the same error - turned out you need to make sure that in your C++ settings you have "Treat wchar_t as built in type" enabled.
|
|
|
|
|
Hi,
How to change the Top level menu item string.
Example File->New .... How to change File to New File ?
|
|
|
|
|
just go to the resource file , you see the menu items. change then name there. recompile and run
If u can Dream... U can do it
|
|
|
|
|
SetMenuItemInfo[^] allows you to change a menu item by handle. This would be useful if you don't have access to the resource file or if you want to use an if/else block to decide how to change the menu.
modified 13-Sep-18 21:01pm.
|
|
|
|
|
In Win32 C++ how to convert
TCHAR* to LPCTSTR
TCHAR to LPTSTR
Please help...
gold
|
|
|
|
|
|
What do you mean by convert?
TCHAR* is merely a pointer to a char or wchar_t depending on the definition of UNICODE . LPCTSTR is a typedef to const TCHAR* so no conversion is necessary; but you may need a cast to satisfy the compiler.
TCHAR is a single character so cannot be converted or cast to LPTSTR ; if you actually meant TCHAR* then both expressions evaluate to the same thing: a pointer to a character or wide character.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Thanx, my one doubt is cleared, about TCHAR to LPTSTR
My Program deals with UNICODE only
a small example will very helpfull for me, of how to convert TCHAR* to LPCTSTR and LPTSTR.
Thanx in advance.
gold
|
|
|
|
|
goldenrose9 wrote: a small example will very helpfull for me, of how to convert TCHAR* to LPCTSTR and LPTSTR.
There is no conversion involved; as I said in my previous post TCHAR* and LPTSTR equate to the same thing, a pointer to a string (character array). LPCTSTR is the same as const TCHAR* , a pointer to a string constant.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
TCHAR* to LPCTSTR is a simple typecast
TCHAR* pch;
LPCTSTR pcch = (LPCTSTR)pch; TCHAR to LPTSTR is an address of operator
TCHAR ch;
LPTSTR pch = &ch;
|
|
|
|
|
LPTSTR __stdcall gHelp(TCHAR value)
{
LPTSTR pch;
pch = &value;
return pch;
}
compiler gives warning
warning C4090: 'return' : different 'const' qualifiers
gold
|
|
|
|
|
You will also have a problem that you are returning a TCHAR* to a TCHAR value, not an array (i.e. string). Do not do this or you will end up with memory overwrites and/or invalid data.
As to your compiler warning, you must have a definition of gHelp which reads something like:
LPCTSTR __stdcall gHelp(TCHAR value);
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
This won't work. You are passing the TCHAR variable by value, so the parameter value is just a temporary local copy, and the address of it will be invalidated upon return! Pass the TCHAR parameter by reference instead, like this:
LPTSTR __stdcall gHelp(TCHAR& value)
...
|
|
|
|
|
Here[^] is an excellent article explaining everything you need to understand C++ strings.
|
|
|
|
|
goldenrose9 wrote: TCHAR* to LPCTSTR
Usually, no conversion needed. If a function is promising you that it won't modify the contents (thereby expecting an LPCTSTR ), you can still pass on a normal TCHAR* to it.
goldenrose9 wrote: TCHAR to LPTSTR
That makes absolutely no sense. TCHAR is a character (wide or not depends on the build), and LPTSTR is a pointer to one such character. How can you convert one to another?!
It was ever thus, the Neophiles will always rush out and get 'The Latest Thing' at a high price and with all the inherent faults - Dalek Dave.
|
|
|
|
|
|
Hi, I'm beginner....
I have a question about MFC...
Fist of all, I make the project, SDI...
and I divided View window with CSplitterWnd in MainFrm...
1 Row, 2 Cols...
and I pasted left windows my basic view window...
and I make a new View class deserved CView.
this point....
I want to know a View class to a Variable....
ex) I do that..
CSecondView* m_Second;
m_Second = new CSecondView;
m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(m_Second), CSize(cr.Width(), cr.Height()), pContext);
but this is error...
I don't know what wrong is ??
|
|
|
|