|
Hello there
I made a sample C++ Win32 console application and then added a class CFileParser.
Now i add a function inside the CFileParser called OpeningInstructions() which is declared as public.
Now i include FileParser.h in the main file of the app having MAIN() function and then trying to call the function.............. and it gives an error as shown below.
Fro some reason it's not able to detect the function inside the clas CFileParser.
Any idea how to resolve this?
Thanks in advance
<pre lang="vb">error LNK2019: unresolved external symbol &quot;public: void __thiscall CFileParser::OpeningInstructions(void)&quot; (?OpeningInstructions@CFileParser@@QAEXXZ) referenced in function _wmain
1&gt;C:\SourceCode\CodeFileParser\CodeFileParser\Debug\CodeFileParser.exe : fatal error LNK1120: 1 unresolved externals</pre></pre>
|
|
|
|
|
Let's see the code for the CFileParser definitions, and also the place where you call it in your main program. Are you sure you added the full implementation into your project? Or, if the CFileParser class is created as an external library, did you include that in your linker preferences?
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
You need to add a cpp file or a lib file to your project depending on what you've got.
If you have FileParser.cpp file (most likely this is the case) do the following:
In the Solution Explorer right click on the project and Select Add->Existing Item. Locate your FileParser.cpp and select it.
If you are given a lib file together with the FileParser.h you need to add it via the Project properties. In the Solution Explorer right click on your project and select Properties. Go to Linker options -> Input. In the Additional dependencies field type the name of your lib file, e.g. FileParser.lib.
|
|
|
|
|
Hi friend,
Presently am working in MFC project. I have to use CALLBACK function but i don't know. Kindly help me. below see my questions
What is CALLBACK? How it work?
what is the advantage of CALLBACK,
please explain with an example
|
|
|
|
|
Call back functions are supplied to some function or data structure as a pointer like (Or I can say, pointer to the starting address of U r function) variable. The pointer is actually a function pointer, and this will be called back when something happens.
Say for example you develop an API function that takes a folder name. For each file found inside the folder, it will perform some operation based on the file name and extension. But the API you write do not know what action to perform and it is decided by the caller. In that case, caller will supply a function address, and your API will call the user supplied function (CALLBACK) for each file. You see that.
|
|
|
|
|
A callback function is a user defined function that a generic API function can use (call back) to do non generic work.
For example, when you have a collection (array, vector, list) of use defined data (struct or class), you want to be able to sort that collection depending on a user defined criteria, you will use the default sorting API, and give that default sorting function a pointer to a callback function that will actually do the comparison between the member of the struct/class.
Another example, is when working with threads; there are multiple generic API to create and manage threads, but all of them needs a callback function; that function will be the actual code that will be run (or a starting point to) by the different threads.
Good luck.
Max.
Nihil obstat
|
|
|
|
|
|
Now I have the crash info:
TestAPP caused an Access Violation (0xc0000005)
in module XCrashReportTest.exe at 0023:5763c230.
Context:
EDI: 0x002aee0c ESI: 0x002ad7f4 EAX: 0x00000000
EBX: 0x00000000 ECX: 0x57635670 EDX: 0x028c1d27
EIP: 0x5763c230 EBP: 0x002aee18 SegCs: 0x00000023
EFlags: 0x00010246 ESP: 0x002ad554 SegSs: 0x0000002b
Bytes at CS:EIP:
8b 08 52 50 8b 41 18 ff d0 8b 0d c8 e0 66 57 8b
Stack:
0x002ad554: 576504f7 002aee0c 002ad7f4 002ad570 ..eW..*...*.p.*.
0x002ad564: 002aee0c 5763c201 002aee18 002ad59c ..*...cW..*...*.
0x002ad574: 576490b1 5763c201 002aee0c 00000100 ..dW..cW..*.....
0x002ad584: 002ad5f4 57648d9f 75785eaa 57668e70 ..*...dW.^xup.fW
0x002ad594: 002aee0c 00000001 002ad604 5764d4d2 ..*.......*...dW
0x002ad5a4: 002aee0c 57668e70 5763c201 00000000 ..*.p.fW..cW....
0x002ad5b4: 00000100 75785d2a 57668e5c 002aee0c ....*]xu\.fW..*.
0x002ad5c4: 57668e4c 002add84 00000000 00000000 L.fW..*.........
I refer to XCrashReport[XCrashReport : Exception Handling and Crash Reporting - Part 1
But I find that sometimes the EIP differed when I run the same *.exe in the same machine. So, sometimes I can't match the crash line of code with EIP(the methods descriped in XCrashReport : Exception Handling and Crash Reporting - Part 1. I don't know how to use the stack info.
Anyone can help me?
|
|
|
|
|
Try running your program through the debugger and look at the stack trace at the point of failure. This will usually help you to narrow the search to the actual function causing the crash.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hi, all. I need anything program or game on C++ Builder 6 with graphic interface, which was realized with Pattern Abstract Factory.
|
|
|
|
|
People here do not hand out completed projects. If you're having trouble with something specific, ask a question and someone will try to help you.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I need to enable re-sizing window without using WS_THICKFRAME style to avoid the thick border.
|
|
|
|
|
Have you experimented with WS_EX_PALETTEWINDOW or WS_EX_TOOLWINDOW ?
Extended Window Styles[^]
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Yes.. but it didn't work.
|
|
|
|
|
Use Spy++ to see what message is sent when you click the window frame.
Here is a related topic.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi Team,
I have create modeless dialog, which contain Edit Box, and put it in Excel.
The problem is every time I enter a text to my edit, the text disappear in Edit Box instead it show in a active cell in Excel.
Does someone has any suggestion?
Below is a code snipped
<pre lang="c++">BOOL CALLBACK ToolDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_COMMAND:
break;
case WM_GETDLGCODE:
return TRUE;
case WM_SETFOCUS:
return TRUE;
case WM_KILLFOCUS:
return TRUE;
default:
return FALSE;
}
return TRUE;
}
void CWPFInDialog::CreateMyDialog(HWND a_hwnd)
{
m_dialogHwnd = CreateDialog(g_hinstDLL, MAKEINTRESOURCE(IDD_DIALOGHOST), a_hwnd, ToolDlgProc);
if(m_dialogHwnd == NULL)
{
ShowWindow(m_dialogHwnd, SW_SHOW);
}
}
Thanks,
PS
|
|
|
|
|
if(m_dialogHwnd == NULL)
{
ShowWindow(m_dialogHwnd, SW_SHOW);
}
Are you sure about this?
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Sorry for the typo
It should be
if(m_dialogHwnd != NULL)
{
ShowWindow(m_dialogHwnd, SW_SHOW);
}
|
|
|
|
|
Given the amount of code you have shown it's anyone's guess what may be happening. However, I did notice that your return value for the WM_GETDLGCODE[^] message is not one of the valid options.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
This is full class definition of creating dialog.
This class is an export class.
header file
#pragma once
#include "WPFInDialogDefs.h"
#include "WPFWrapper.h"
class WPFINDIALOG_API CWPFInDialog {
public:
CWPFInDialog(void);
void CreateMyDialog(HWND a_hwnd);
private:
HWND m_dialogHwnd;
CWPFWrapper m_wrapper;
};
cpp file
#include "stdafx.h"
#include "WPFInDialog.h"
#include "resource.h"
extern HINSTANCE g_hinstDLL;
CWPFInDialog::CWPFInDialog()
{
}
BOOL CALLBACK ToolDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_COMMAND:
break;
default:
return FALSE;
}
return TRUE;
}
void CWPFInDialog::CreateMyDialog(HWND a_hwnd)
{
m_dialogHwnd = CreateDialog(g_hinstDLL, MAKEINTRESOURCE(IDD_DIALOGHOST), a_hwnd, ToolDlgProc);
if(m_dialogHwnd != NULL)
{
ShowWindow(m_dialogHwnd, SW_SHOW);
}
}
To create the the dialog, I just
CWPFInDialog* l_atsWrapper = new CWPFInDialog();
l_atsWrapper->CreateMyDialog(l_hwndExcel);
l_hwndExcel is an excel handle
to get the excel handle I call
CComPtr<Excel::_Application> l_excelApp;
HRESULT l_hr = g_excelMgrSingleton.GetExcelApplication(&l_excelApp);
HWND l_hwndExcel;
l_hr = l_excelApp->get_Hwnd((long*)&l_hwndExcel);
no clean up for l_atsWrapper
|
|
|
|
|
You may need to contact the provider of this class, or check its documentation. I can find no information about it.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Richard MacCutchan wrote: However, I did notice that your return value for the WM_GETDLGCODE[^] message is not one of the valid options. While DLGC_WANTARROWS is a valid return code, I'm not sure it makes sense in this context.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi!
I got the following erros during compilation.
Error 2 error BK1506 : cannot open file '.\Compilations\PlugIn_Debug_Win32\PlugIn.sbr': No such file or directory BSCMAKE
Error 1 fatal error C1902: Program database manager mismatch; please check your installation d:\plugin\stdafx.cpp 1
The source is transferred from another machine. When I rebuild the code for the first time(I've not modified the code),it compiles fine.
But when I made changes to the code and recompile it shows the above two errors. Both machines have SP1 for VS2005. How to resolve the above two errors?
|
|
|
|
|
You probably did not only copied the source but also some output files.
Try a complete rebuild to overwrite the copied output files. If this does not help, delete all files except the source and project files and rebuild.
|
|
|
|
|
Jochen Arndt wrote:
delete all files except the source and project files and rebuild.
I deleted the Program Database (.pdb) file. By all files you mean what other files?
|
|
|
|