Click here to Skip to main content
11,928,919 members (46,900 online)
Rate this:
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
Posted 7-Feb-13 19:30pm
Edited 8-Feb-13 3:21am
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

Rate this: bad
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.
//All your code
#pragma once

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.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.151126.1 | Last Updated 11 Feb 2013
Copyright © CodeProject, 1999-2015
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