x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Public / Private / None class creation

Once you have selected either Public or Private class when creating a new C++ class, then you do not appear to be able to NOT have a class be either Public or Private again for that project in the future (i.e., there's no way to un-select ). This leads to issues with someone new to the system as header files are then no longer found for any newly created classes. There's probably a way around that, but it sure would be nice to be able to go back to not having the value selected and having working headers for a simple project.

Product Version: UE 4.10
Tags:
more ▼

asked Mar 21 '16 at 08:52 PM in Bug Reports

avatar image

blitzd
6 1 3 6

avatar image Doug E ♦♦ STAFF Mar 22 '16 at 02:33 PM

Hey blitzd-

I'm not sure exactly what you're referring to. I was able to create 2 classes based on Actor (both marked as private when creating them in the editor) and successfully compile after adding #include "MyOtherActor.h" inside of the first class's header file. Could you provide an example of what you're reporting or give steps for me to reproduce the issue on my end?

avatar image blitzd Mar 22 '16 at 06:14 PM

At it's simplest it comes down to once you select public or private for a class in the creation there does not appear to be a way to NOT select it in the future. When I create a new project neither is selected when I go to create a class, but after having selected one there is no way to un-select either of them.

The more complicated bit, which I suspect there may be a way around, is that VS then does not find my class.h inside the Public folder, and I then get every little thing in the class.cpp listed as an error, and no intellisense. This does not occur if I do not select Public or Private for the class on creation, as both files end up in the same directory.

avatar image Schithsification Nov 16 '17 at 10:56 AM

I'm facing the same issue since this bug is still there in version 4.18. I selected public ones and now I have no way to deselect it when creating new classes. It puts the header in public folder and cpp file in private. I can't even open the public folder inside the editor and private folder isn't even visible when both are there in the explorer.

I ended up deleting a whole bunch of files from the project and now it's back to normal.

avatar image crossmr Sep 12 '18 at 09:25 AM

This is an old thread, but wanted to put my name down for having it fixed as I've run into this issue. It's basically a trap for new users.

avatar image OMGTKB Nov 09 '18 at 02:54 AM

Unfortunately, the bug report for this issue (UE-28648) was marked as "won't fix" over a year ago. However, I have been able to work around this issue. I'm using git source control with a standard gitignore like the one found at https://github.com/github/gitignore/blob/master/UnrealEngine.gitignore . After cloning the project to a new directory, the problem disappeared. This means that the problem is in one of the local disposable files. I don't know exactly which file that would be, but you could try deleting Binaries, Intermediate/Build, etc. Basically any of the files/directories found in the list at https://github.com/github/gitignore/blob/master/UnrealEngine.gitignore .

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I was able to reproduce the issue of the Public/Private being auto-selected when creating new classes and submitted a bug report for it (UE-28648). I have created both public and private classes but have not had any issues with Visual Studio not being able to associate the .cpp with the .h. Are you specifically using Public or Private (or do you have this issue with both)? Do you have the same association issue in a new project if you create a class without selecting either public or private?

more ▼

answered Mar 22 '16 at 09:06 PM

avatar image blitzd Mar 23 '16 at 04:33 AM

I'm honestly not familiar with VC++ and header files, but the gist of the problem is that it's not scanning the Public folder that it puts the header in in VS. Simplest re-creation for me is to create a new project, create a class that is Public, open the cpp and find that everything is marked as an error because it cannot locate the header in the Public folder. Header is in Public, and cpp is in Private.

I can solve the issue by manually adding that folder to the project include folder, but with a more complicated folder structure that's not really a viable solution.

Otherwise, here's what I get:

alt text

And if I right click on the MyActor.h and select the 'Open Document' function here:

alt text

I get:

alt text

So, VS obviously doesn't know where that file is located by default.

untitled3.png (72.8 kB)
untitled4.png (14.6 kB)
untitled5.png (235.5 kB)
avatar image Doug E ♦♦ STAFF Mar 23 '16 at 05:48 PM

Based on the third screenshot it appears to be looking for the the header file in the same Private folder that the source file is in. If you edit the include statement to show the full path to the header file ([ProjectName]/Source/[ProjectName]/Public/[HeaderName]) are you then able to compile the class?

avatar image blitzd Mar 23 '16 at 09:20 PM

Hey Doug, I can certainly use the following path for the include:

 #include "Public\MyActor.h"

and that does work. I was expecting that when the UE editor creates a class for me it's not broken by default though. Shouldn't it create the "Public\..." if I have selected a Public class?

avatar image Doug E ♦♦ STAFF Mar 24 '16 at 02:42 PM

That is a part of the report I submitted previously. Until we have a chance to address this bug, adding the "Public" portion of the include manually will be the easiest workaround.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question