|
I see by your reply to sunit5 that you probably found the problem (declared but undefine variables).
As for specifing inline:
inline int func(int n) {...}
If the inline function is needed by several files, then you would place it in a header file.
If the inline function is only needed by one file, then place it in that file.
Given a choise between macros and small inline functions, prefer inline functions (when ever possible). This does not only make reading the code easier, it also lets the compilire validate the arguments (which prevents hard to find bugs).
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
i had similar problem.but i did a mistake.i defined an external variable in main.h.which was included in every .cpp file.one should only declare external variable ,functions, classes or structures.pls check out any defination is not present in main.h
|
|
|
|
|
I'm not sure what you mean here. but I do have defined variables as external in main.h, but I don't define them again in the other .cpp-files again (as I guess you had done)
aah now when I come to think of it (damn I'm a lousy c++ user ) I need to check if I defined those variable instead of declaring them
Joakim .A - State: VB6 -> VB.NET
|
|
|
|
|
Is there a way to search for a particular word in a file, no matter where it may be placed. I don't think opening the file and just using getline will work. Maybe there is a tool out there I can make use of in my code?
Danny
|
|
|
|
|
bugDanny wrote:
Is there a way to search for a particular word in a file, no matter where it may be placed.
Sure. Open the file. Read the contents into a buffer. Search that buffer. Are you using C++, MFC, or just the Windows SDK?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I'm using C++, but I could use MFC if needed. I suppose I was thinking of using getline to read the contents of the file word by word. You mean that I should read the whole file into a buffer, not just word by word. That would make it a lot easier to go back and forth in my search. I suppose I just didn't think of it that way.
Danny
|
|
|
|
|
bugDanny wrote:
You mean that I should read the whole file into a buffer, not just word by word.
Correct.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I am using rich edit control in dialog based application. I have copied this piece of code from a book but it is giving me an error. Please check what is this.
DWORD CALLBACK WriteEditData(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG FAR *pcb)
{
CFile *pFile = reinterpret_cast<cfile*>(dwCookie);
try
{
pFile->Write(pbBuff,cb);
}
catch(CFileException *pEx)
{
pEx->Delete();
*pcb = 0;
return 0;
}
*pcb = cb;
return 1;
}
void CRE4View::OnBStr()
{
CFile fWrite("C:\\file.rtf", CFile::modeReadWrite);
EDITSTREAM strm;
strm.dwCookie = reinterpret_cast<dword> (fWrite); //error
strm.pfnCallback = WriteEditData;
m_Info.StreamOut(SF_RTF, strm);
}
Error message is,
error C2440: 'reinterpret_cast' : cannot convert from 'class CFile' to 'unsigned long'
Please reply.
Aqueel A. Mirza
We Believe in Excellence
|
|
|
|
|
I would think that since WriteEditData() is casting dwCookie to a pointer, then you would also have to send it a pointer like:
strm.dwCookie = reinterpret_cast (&fWrite);
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Thanks it works...
We Believe in Excellence
|
|
|
|
|
Ich want to know which windows-design is selected by the current user.
Is the any method to detect it?
I need this, because some control-elements have not the same size in the different styles an I want to adept my programm.
thanks
Gabriel
|
|
|
|
|
See here for starters.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
hi,
Is anybody knows how to convert icon into bitmap using either "public: Bitmap* ToBitmap()" command or using anyother command in vc++.
thank you
|
|
|
|
|
rgchezhian wrote:
Is anybody knows how to convert icon into bitmap using either "public: Bitmap* ToBitmap()" command
I presume it would be something like:
CIcon icon;<br />
Bitmap *bitmap = icon.ToBitmap();
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
i think there is no class as CIcon in vc++.
|
|
|
|
|
|
can anyone help me in making a very nice interface of traveling salesman problem using genetic algorithm. its a user defined interface wherein the user will input sets of points and the program will be to create a graphics about what the user have inputted. hope somebody can help me with this im just a student and i really am not yet familiar with the language hope someone will reply me to this urgently. thanks a lot in advance.
lester
|
|
|
|
|
|
any nice visible interface in the net. an example of a user-defined representation? pls help me!
lester
|
|
|
|
|
I think one of the projects here on CodeProject uses this library.
I have not used it in a project yet.
|
|
|
|
|
how do i get the directory of internet explorer so i can launch a help file in html format using winexec?
/\|-||\/|/\|)
|
|
|
|
|
Halawlaws wrote:
...using winexec?
Use ShellExecute() instead.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
DavidCrow wrote:
ShellExecute()
what parameters does it take?
/\|-||\/|/\|)
|
|
|
|
|
Halawlaws wrote:
what parameters does it take?
See here.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
can u please write the function with the parameters for a file named C:\help\index.htm?
coz it didnt work
/\|-||\/|/\|)
|
|
|
|