Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have an application in which I am using same function in different .cpp file so I defined this function in separate .h file but when I am adding this .h file in one .cpp file then its fine but when I am adding same .h file in another .cpp file then error comes that "error C3861: identifier not found" . I am trying but not able to solved please help..

I am developing vc++ mfc Dialog based application which have two dialog and each dialog have two .cpp file and one .h common file which separated from dialog, and I want to use function in both .cpp file(function are defined in the .h file),so I include the .h file in both the .cpp file but its shows error "error C3861: identifier not found" please help..me..
Posted
Updated 8-Feb-13 2:21am
v4
Comments
[no name] 8-Feb-13 1:01am    
Post your code here.
Matthew Faithfull 8-Feb-13 5:48am    
Yes, post some code and the error message. We need to know which identifier it is that's not found or how can we find it for you.
Matthew Faithfull 8-Feb-13 8:18am    
Please paste the entire C3861 error message we need to see the identifier that is not found. Then you will need to search your code for that exact identifier if you're not going to post the code, and say the actual names of the files in which it occurs.
LokoLuke 8-Feb-13 8:33am    
Sounds like the .cpp files are getting confused because of a namespacing issue. Are either of these .cpp referencing each other in either way?
Richard MacCutchan 8-Feb-13 12:07pm    
Show the source code and indicate exactly where the error occurs. We cannot see your screen or guess what your source code looks like.

1 solution

This should be perfectly acceptable if you've done it correctly. Make sure your header only gets processed once using a header guard.
Either:
#ifndef HEADER_NAME
#define HEADER_NAME
//All your code
#endif

-OR-
#pragma once
//code


Your error indicates that you have some identifier that isn't defined anywhere in your code (might be a prototype mismatch). Without more information, it's kind of hard to guess where your actual problem arises.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900