|
|
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
|
|
|
|
|
|
Thanks a lot,
But you get a regulat key? for the other computer ?
your link is exactly what I was looking for!
Thanks and Regards,
TPP
|
|
|
|
|
I have found a few examples of how to use the richedit control 4.1 within an MFC app, but does anybody know how I can implement its usage in a non-mfc app?
I have a dialog with a rich edit control which contains a table. currently I'm using version 3 of the control which shows the table, but when it comes to populating cells I'm having problems. Mainly that the control doesn't seem to implement much of the table formating commands. The table cells do not resize, /par is ignored /qc is ignored etc...
I doubt my code is to blame as I am simply loading a rtf file created with version 4.1 and displaying it within my own control.
|
|
|
|
|
Nevr mind, I fixed it. For anybody else who may be trying to do the same:
In WinMain:
InitCommonControlsEx()
LoadLibrary( "Msftedit.dll" ); // check the return value
When creating the window:
CreateWindowEx(0,"RICHEDIT50W","",WS_TABSTOP ....
If you created the control using the resource editor, you must open the .rc file with a text editor and change the class from "RICHEDIT" to "RICHEDIT50W".
Point to note, the Msftedit.dll is not distributable, and it will only work with Windows XP service pack 1 and above.
|
|
|
|
|
Hi everyone. anyone knows how to create a trackbar in visual c++ using Win32 API?? I dont know what header file to include. Thanks in advance.
AmanN
|
|
|
|
|
You need to include commctrl.h and link with comctl32.lib. You create a trackbar pretty much the same as any other control
InitCommonControls();
hwndTrack = CreateWindowEx(
0,
TRACKBAR_CLASS,
"Trackbar Control",
WS_CHILD | WS_VISIBLE |
TBS_AUTOTICKS | TBS_ENABLESELRANGE,
10, 10,
200, 30,
hwndDlg,
ID_TRACKBAR,
g_hinst,
NULL
);
You can find a wealt of information here[^] regarding track bars and how to use them.
|
|
|
|
|