|
hi
i have a simple question, I usually see such line of code in someones class(for example) :
void CSomeClasss::Get(CString str, TCHAR tchar )
{
...
}
I am interested in what is the use of writing /*= _T(' ')*/
-- modified at 2:43 Saturday 18th March, 2006
|
|
|
|
|
Nothing special...It is just to remind oneself what kind of input he is recieving at the time of calling. Statement written between /* and */ is not executed in c++. We use it to explain, what this piece of code is doing. So you can write any thing between it.
Good Luck.
We Believe in Excellence
www.aqueelmirza.cjb.net
-- modified at 2:53 Saturday 18th March, 2006
|
|
|
|
|
It's just tell compilers and readers that this parameter is not used in this function.You will appreciate it if you are using visual c++ and set the warning level to 4
Easycvs is an easy and quick tool for version control system.it's a cvs integrated into Visual studio.
For more information,please visit http://www.easyvcs.com/
|
|
|
|
|
"It's just tell compilers and readers that this parameter is not used in this function"
if so then why don't simply remove this parameter >
|
|
|
|
|
Because when people like you or me look at this function, we know exactly what is passed to it without having to step through it. This is the mark of a good programer. Lamers who do not add comments to their code often spend more time re reading their code than doing the actual programing.
Adding comments is good practice for both yourself and for others who may one day edit your code.
|
|
|
|
|
Oh,I'm sorry for looking it as "TCAHR /*tchar */"
In your case,it's just because this function has a default
argument,you can't use "TCHAR tchar= _T(' ')" in the definition after you hase declared this function.
But if you remove this comment,you may forget that this parameter has a default argument.
It's nothing special;P
Easycvs is an easy and quick tool for version control system.it's a cvs integrated into Visual studio.
For more information,please visit http://www.easyvcs.com/
|
|
|
|
|
|
First of all TCHAR tchar is definitely used in the function, unlike someone has pointed few posts above.
by writing TCHAR tchar /*= _T(' ')*/ along with function argument it becomes clear that tchar has a default value of ' '. So in the class declaration this function would have been defined as
<br />
class CSomeClasss<br />
{<br />
.<br />
void Get(CString str, TCHAR tchar = _T(' '));<br />
.<br />
};
This makes it easy to remember that tchar have a default value of ' ' during read code or debugging.
-Saurabh
|
|
|
|
|
I use FreeImage in my MFC app to view image infos as http://codeproject.com/bitmap/graphicsuite.asp#xxxx[^]
But when compile....
DlgImageInfos.obj : error LNK2001: unresolved external symbol
__imp__FreeImage_GetDIBSize@4
DlgImageInfos.obj : error LNK2001: unresolved external symbol __imp__FreeImage_GetHeight@4
DlgImageInfos.obj : error LNK2001: unresolved external symbol __imp__FreeImage_GetWidth@4
DlgImageInfos.obj : error LNK2001: unresolved external symbol __imp__FreeImage_GetDotsPerMeterY@4
DlgImageInfos.obj : error LNK2001: unresolved external symbol __imp__FreeImage_GetDotsPerMeterX@4
DlgImageInfos.obj : error LNK2001: unresolved external symbol __imp__FreeImage_GetColorType@4
DlgImageInfos.obj : error LNK2001: unresolved external symbol __imp__FreeImage_GetColorsUsed@4
DlgImageInfos.obj : error LNK2001: unresolved external symbol __imp__FreeImage_GetBPP@4
Anyone can debug for me,thanks so much !!
|
|
|
|
|
This type of error is common when you forget to link with the correct library file. I have not used the graphicssuite before but I can see there is a .lib file included in the sources. Make sure you have also added this to your project.
In MSVC project settings -> Link -> input -> and add it to the Object/Library modules
|
|
|
|
|
Hi, I using some of the ODBC function that only supported in 3.0. However, I don't know if the computer that I'll run the application have the ODBC 3.0 or not. How can I get this information out of the computer and where to get the version update if it is not the latest.
Thanks
|
|
|
|
|
nhuythanh wrote: How can I get this information out of the computer and where to get the version update if it is not the latest.
Look around the Control Panel for anything to do with ODBC.
|
|
|
|
|
I have captured video from webcam with default frame rate.(i,e)15 fps
How to calculate the frame rate on reciving side?
DWORD dwRequestMicroSecPerFrame;
Requested frame rate, in microseconds. The default value is 66667, which corresponds to 15 frames per second.
JAYARAJ
-- modified at 23:27 Tuesday 21st March, 2006
|
|
|
|
|
I am loading a a .rtf file and displaying the contents within a rich edit control. After updating to the latest verson (4.1) of the edit control I am having some trouble correctly displaying data within a table. The main problem is that none of the data is being show.
Strange thing is, if I open the rtf file in one of the demo projects here on codepage, the data is displayed correctly. Since there is not much code involved, it leads me to beleive it is a problem with the initialisation.
Has anybody experienced similar problems, or know of any good websites which document richedit 4.1 or the rtf format? All I am able to find are a few poorly commented MFC examples, which I am trying to convert to use in a non-MFC application.
|
|
|
|
|
Hello everyone!
Alright... Look at the top of my file:
================
// Size of screen
#define WIDTH 640
#define HEIGHT 480
// Character/Tile size
#define CSIZE 16
// Window title
#define WINTITLE "Test SDL game..."
#include <iostream> // Standard lib
using namespace std; // Standard lib
#include "SDL.h" // SDL
#include "SDL_image.h" // SDL_image (for loading non-BMP graphics)
#include "DisplayHandling.cpp" // And this one handles displaying to screen
================
I get this error:
================
/home/kixdemp/devel/sdltest/src/DisplayHandling.cpp:32: error: ‘IMGDIR’ was not declared in this scope
================
How is it not declared, if I declared it just above it?
Also, I have a second question... I have this at the top of another file:
================
#ifndef _GAMECLASS_CPP_
#define _GAMECLASS_CPP_
================
But I still get a function redefinition error on the function in that file...
Whoever answers these quiestions, will be the true king of England!
Just kidding, but, thanks!
BTW: There's something wrong with the code tag...
Lord Kixdemp
www.SulfurMidis.com
www.SulfurSoft.tk
[ftp://][http://][hotline://]tsfc.ath.cx
|
|
|
|
|
I can't see where you've declared IMGDIR .
Also re-inclusion guards are normally used for header files not C/C+ files.
Including a .CPP file is almost certainly a bad idea (although there are exceptions to every rule).
Steve
|
|
|
|
|
Well... Yeah, I forgot to define those... But it still doesn't work after it's defined:
========================
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
// Size of screen
#define WIDTH 640
#define HEIGHT 480
// Character/Tile size
#define CSIZE 16
// Window title
#define WINTITLE "Test SDL game..."
// Path to images directory
#define IMGDIR "./images/"
// Main character's image file
#define CHRIMG "robot0.png"
#include <iostream> // Standard lib
using namespace std; // Standard lib
#include "SDL.h" // SDL
#include "SDL_image.h" // SDL_image (for loading non-BMP graphics)
#include "GameClass.cpp" // This class handles the game's internal engine
#include "DisplayHandling.cpp" // And this one handles displaying to screen
========================
I get all of these errors:
========================
compiling sdltest.cpp (g++)
compiling DisplayHandling.cpp (g++)
/home/kixdemp/devel/sdltest/src/DisplayHandling.cpp: In member function ‘int DispHnd::Init(char*, GameClass*)’:
/home/kixdemp/devel/sdltest/src/DisplayHandling.cpp:33: error: ‘IMGDIR’ was not declared in this scope
/home/kixdemp/devel/sdltest/src/DisplayHandling.cpp:33: error: ‘CHRIMG’ was not declared in this scope
/home/kixdemp/devel/sdltest/src/DisplayHandling.cpp:65: error: ‘WIDTH’ was not declared in this scope
/home/kixdemp/devel/sdltest/src/DisplayHandling.cpp:65: error: ‘HEIGHT’ was not declared in this scope
/home/kixdemp/devel/sdltest/src/DisplayHandling.cpp:75: error: ‘WINTITLE’ was not declared in this scope
/home/kixdemp/devel/sdltest/src/DisplayHandling.cpp: In member function ‘void DispHnd::Render()’:
/home/kixdemp/devel/sdltest/src/DisplayHandling.cpp:99: error: ‘CSIZE’ was not declared in this scope
/home/kixdemp/devel/sdltest/src/DisplayHandling.cpp:114: error: ‘WIDTH’ was not declared in this scope
/home/kixdemp/devel/sdltest/src/DisplayHandling.cpp:114: error: ‘HEIGHT’ was not declared in this scope
========================
But it WAS declared! Why that error? Thanks!
BTW: I'm using KDevelop in Linux.
Lord Kixdemp
www.SulfurMidis.com
www.SulfurSoft.tk
[ftp://][http://][hotline://]tsfc.ath.cx
|
|
|
|
|
Create a new header file called "MyDefines.h", place all your defines into this file and eddit them out of your existing files. You may also use a #ifdef #endif block.
Include this file into the top of all your cpp files. You should not #include other .cpp files as stated by the previous poster (there are only extremly rare cases and this is not one of them). The cpp do not need to know about other cpp, it's enough to include the same header. Depending on your compiler all you need is to compile the whole project.
That should fix your problem.
In your MyDefines.h file you may also add function prototypes ie.
void MyFunction1(int foo);
bool MyFunction2(int bar);
And later create these functions in whichever files you need. This will help resolve some undefined function errors.
Also you may add global variables but you try not to use any code. As a rule of thumb, .cpp holds your program, .h binds your program.
|
|
|
|
|
Damn... I did that, but now I get:
Fatal signal: Segmentation Fault (SDL Parachute Deployed)
I put a test cout line before the very first line in main() , and I saw the output of that line after the error... What is it? Is it a problem with the SDL files? Do you know? Thanks!
[EDIT] Fixed! There was a piece of code causing a memory leak... Thanks! [/EDIT]
Lord Kixdemp
www.SulfurMidis.com
www.SulfurSoft.tk
[ftp://][http://][hotline://]tsfc.ath.cx
-- modified at 19:22 Saturday 18th March, 2006
|
|
|
|
|
Hi,
I have never tried to derive a class from one of my own classes until now, but there is a problem. I have a simple class called CInstrument defined in the Instrument.h file. Since I have many instruments I wanted to derive a class for each unique instrument. For an oscilloscope I defined a class COscilloscope : CInstrument in the Oscilloscope.h file that also #includes the Instrument.h file. There is a third class where I want to create an instance of the Oscilloscope object but if I #include Oscilloscope.h in the third class then I get a C2011 'class' type redefinition error. I can't find where any #include is including the definition twice. Is there something basic that I am not seeing? My stuff looks like the examples in the texts I have.
Thanks
Buck Brown
|
|
|
|
|
Do you have a #pragma once in your header file? Or at least an #ifdef wrapper around your class declaration?
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
1st put re-inclusion guards in you header files. e.g.
#ifndef __HEADER1_H__
#define __HEADER1_H__
#endif // !__HEADER1_H__
The preprocessor symbol __HEADER1_H__ is named after the file - The important thing is that it's unique.
As PJ Arends mentioned you can use #pragma once to achieve the same effect on compilers that support it.
Also when you derive it looked like this:
<code></code>class COscilloscope : CInstrument
You probably meant this:
<code></code>class COscilloscope : public CInstrument
What you had is the same as this:
<code></code>class COscilloscope : private CInstrument
Legal but probably not what you intended.
Steve
|
|
|
|
|
Thanks,
I love simple answers. Works great, lasts a long time.
Buck
|
|
|
|
|
Hello ,
I would be grateful if you could tell me exactly how to download
VC++ Express Edition 2005 on a CD rom.
This in order to setting it up on an other computer.
Can I have a key too?
Note that the other computer has no internet connection.
Also, where could I find tested samples for VC++ Express Edition 2005.
I Thank you!
Regards,
TPP
|
|
|
|
|