Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 672
  • Last Modified:

How to pass CString parameter to function?

Hi

I got error below when try to pass CString param to function.

error LNK2001: unresolved external symbol "char __cdecl ProcessFile(class CString)" (?ProcessFile@@YADVCString@@@Z)

Can Anyone here explain to me and how to solve it. thanks
0
titanium0203
Asked:
titanium0203
2 Solutions
 
käµfm³d 👽Commented:
Can you provide the function's signature and an example of how you tried to call it?
0
 
titanium0203Author Commented:
int abc()
{
.....
ProcessFile(filename);
....
}


char HandleChange::ProcessFile(CString CBLKver)
{
      OutputDebugString("Process File");
      return 1;
}
0
 
käµfm³d 👽Commented:
Did you include the header for the file containing the function definition?
0
 
ZoppoCommented:
Hi titanium0203,

you call 'ProcessFile' as if it was a global function, not as a member function as it's declared - you need an instance of the class HandleChange to call it, i.e.:

int abc()
{
.....
HandleChange obj;
obj.ProcessFile(filename);
....
}

ZOPPO
0
 
trinitrotolueneDirector - Software EngineeringCommented:
Here's my 2 cents :

"error LNK2001: unresolved external symbol "char __cdecl ProcessFile(class CString)" (?ProcessFile@@YADVCString@@@Z)"

The linker is not able to find a matching function definition and thats the reason for the error. So here's what you should do :

int abc()
{
.....
ProcessFile(filename);    ------------> check that 'filename' is a CString and abc() is also a member function in class HandleChange. Else you can't call Process File the way you have done.
....                                                  ------>use an object of Handlechange otherwise to call ProcessFile()
}



0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now