Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++
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 7-Feb-13 19:30pm
debarunb1.1K
Edited 8-Feb-13 3:21am
v4
Comments
Matthew Faithfull at 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 at 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 at 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 at 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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 5,170
1 DamithSL 4,357
2 Maciej Los 3,750
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,851


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 11 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100