Jump to content
  • Advertisement
GameDevCoder

C++ I tried posting in Unreal forum but my post doesn't appear so trying here. Help with an issue in the c++ Battery Collector tutorial. Screenshots included.

Recommended Posts

I am looking to learn C++ in Unreal so have commenced the tutorial '3rd Person Battery Collector Power Up Game'.

It is on the 3rd video of the series that I have come across an issue. In the screenshot I have attached labelled 'picture 1', this is the tutors class which is correct. My screenshot 'picture 2' is where I see some issues.

- my #include is in a grey colour font. It should be red right?
- I also do not have a #include "BatteryCollector.h" in my class also. In the tutors example this line of code is present.

Can anyone help me with why I have these issues. I am using Visual Studio 2015 as well. I thought would using VS'17 help so I installed this today. I have yet to try this out with that though but then I thought. Shouldn't it work fine on VS'15 anyway, would using VS'17 make much difference at all.

I am very keen to work through this tutorial today so if the forum might be able to help me I would be so so grateful.

Thank you.

gamedevPic1.png

gamedevPic2.png

Edited by GameDevCoder

Share this post


Link to post
Share on other sites
Advertisement

Case matters. "Pickup" is not the same as "PickUp".

I notice that the .h file is called Pickup, while you are trying to include "PickUp.h". Same with all the functions.

Share this post


Link to post
Share on other sites
19 minutes ago, Lactose said:

Case matters. "Pickup" is not the same as "PickUp".

I notice that the .h file is called Pickup, while you are trying to include "PickUp.h". Same with all the functions.

Oh my, thanks very much for spotting. I shall open up the project and see if this sorts it all out. I hadn't realised I made an error with how I named the class. Well spotted and thank you again for spotting this. Shall post an update with how it turns out.

Share this post


Link to post
Share on other sites

Took awhile to try this out as I was finding it tricky to just remove the class i had before, done now though. So now making it again with the correct title. 'include' is still grey unfortunately. Maybe it being grey doesn't matter, possibly just something i can change in the font colour merely. It's strange how the examples code has that other line of text in it though too. I may just try pressing on with the tutorial and find out if this include thing is stifling me down the line.

gamedevPic1.png

Share this post


Link to post
Share on other sites

The color of things is your preference, they have no effect on C++ what-so-ever.  I personally prefer the dark scheme for visual studios as the white strains my eyes I find after many hours coding.  You didn't have to remove your previous class to fix your mistake, you merely had to change #include "PickUp.h" to #include "Pickup.h" the filenames don't effect the class in any way at all.  You could have also just right clicked on the file in Solution Explorer on the right side and picked Rename too.

Also, instead of posting your worries/concerns here, hit F7 to build your project and see if there are errors.  Then post those errors if you, after researching them (best way to learn), still cannot figure out the solution.  But just retyping someone else's code is no way to learn.  You need to try and understand what the code is doing and why it is working.

Share this post


Link to post
Share on other sites
11 minutes ago, Mike2343 said:

The color of things is your preference, they have no effect on C++ what-so-ever.  I personally prefer the dark scheme for visual studios as the white strains my eyes I find after many hours coding.  You didn't have to remove your previous class to fix your mistake, you merely had to change #include "PickUp.h" to #include "Pickup.h" the filenames don't effect the class in any way at all.  You could have also just right clicked on the file in Solution Explorer on the right side and picked Rename too.

Also, instead of posting your worries/concerns here, hit F7 to build your project and see if there are errors.  Then post those errors if you, after researching them (best way to learn), still cannot figure out the solution.  But just retyping someone else's code is no way to learn.  You need to try and understand what the code is doing and why it is working.

thanks for the post. some very handy tips there. Just want to mention. One issue i was having was the #include for my class was greyed out. In the tutorials example 'include' is in blue font. I don't mean the white background or anything. Would you be able to comment on this bit at all? I think u may have covered something about this but I just wanted to clarify my concern I was having.

Share this post


Link to post
Share on other sites

Yes, the very first line of my reply covered it.  The color of your #include has zero effect on what C++ does.  It's merely an IDE preference you can change.  Had you tried to compile, it may have been successful.  The UE4 team likely changed their color scheme to make it more readable on stream/video or just prefer their IDE that way.  The # indicates a preprocessor event.  If you type #define SOMETHING above the #include it will be the same color as the #include.  As it's the # that decides what color the IDE assigns to the following text (until the space).

Again, hit F7 and see what happens.  Do you get errors/warnings in the output window below about it?  If not, there is nothing to worry about, carry on learning.  Also learning "C++" from UE4 tutorials will not really teach you C++.  They have a lot of very specific and highly custom things they've coded up that do not exist in C++.  Just be forewarned you will likely have to unlearn things to program in C++ outside the Unreal engine.

Share this post


Link to post
Share on other sites
6 minutes ago, Mike2343 said:

Yes, the very first line of my reply covered it.  The color of your #include has zero effect on what C++ does.  It's merely an IDE preference you can change.  Had you tried to compile, it may have been successful.  The UE4 team likely changed their color scheme to make it more readable on stream/video or just prefer their IDE that way.  The # indicates a preprocessor event.  If you type #define SOMETHING above the #include it will be the same color as the #include.  As it's the # that decides what color the IDE assigns to the following text (until the space).

Again, hit F7 and see what happens.  Do you get errors/warnings in the output window below about it?  If not, there is nothing to worry about, carry on learning.  Also learning "C++" from UE4 tutorials will not really teach you C++.  They have a lot of very specific and highly custom things they've coded up that do not exist in C++.  Just be forewarned you will likely have to unlearn things to program in C++ outside the Unreal engine.

Thanks so much for your replies. They both read incredibly helpful. I will have to go over them properly later on when I'm in Unreal also. Much appreciated and thanks very much again for the reply. Most helpful.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!