Error C3767 candidate functions not accesible

i'm getting this error (candidate functions not accesible) when trying to use get/set methods from file Allformvariables.h in MyForm.h

I'm putting variables in a seperate class to the form because i want to use the same variables in multiple different forms (at different times) and so im using a private scope for the variables and have my get/set methods as public.

However for some reason i get the error in title when building it.

i have tried #pragma make_public(type) but not sure if i was using the right type or putting it in the right place...

if you need code i will put it in but its larger than i like to put in posts. any help would be greatly appreciated.

This is for my A2 computing project so i really need it done but can't figure it out
Last edited on
I think that the message means that the compiler found the best appropriate function to call but the funcion either has private or protected access control that is it is inaccessible from the code where it is called.
well thats what i figured aswell. but both the functions are all set as public and i still get the error. I know that VS 2012 sets all native types as Private but when i try to override them using #pragma make_public(type) it dosn't change anything.
I suspect i'm probably using that wrong but i can't figure out any other way to do it.

my code in the class is

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
private:
	Allformvariables(void);
	//variables used on multiple forms
	float WindSpeed;
	float Gravity;
	float restitution;
	char WindDirection;
	Point MouseStart;
	Point MouseEnd;
	Point Velocity;

	//Set items

public: void Setfloats(float x, int change ) {
			   switch (change)
			   {
			   case 1:
				   WindSpeed = x;
				   break;
			   case 2:
				   Gravity = x;
				   break;
			   case 3:
				   restitution = x;
				   break;
			   }
		   }
public: void Setchar(char n, int change) {
			switch(change)
			{
			case 1:
				WindDirection = n;
					break;
			}
		}
};
Show he code that genereates the error.
Well it says its on this line
MyForm(void) in my form but theres nothing on that line to do with my class so im assuming its a global thing

This is the code im using to make an instance of the class in my main form
Allformvariables Variables;

and thats in a global scope in MyForm.

the full error given by VS 2012 is

Error 3 error C3767: 'Allformvariables::Allformvariables': candidate function(s) not accessible c:\users\gaz\documents\visual studio 2012\projects\projectilemotion\projectilemotion\Simulation.h 22

(simulation.h is MyForm i didn't change the name proberly)

Thanks in advance for any help you might be able to give

Last edited on
Listen, why do you bother the forum? Are you unable to read? The error message is clear enough

'Allformvariables::Allformvariables': candidate function(s) not accessible


This fuction is declared by you as privte!

private:
Allformvariables(void);
Last edited on
i thought that because the functions Setfloat and Setchar were public i would be able to access them using the Variables instance in my main form.

That is the problem though so thank you for pointing that out.

Is there anyway i could make that a protected function and still be able to use it or does it have to be public??

I am a beginner at this as i said im doing my A2 computing course which is 2nd year of college and my tutors pretty useless at this so i have to ask for outside help if i get stuck. But thanks for the help you've already given
Topic archived. No new replies allowed.