Could I get some help with a small syntax problem?
So I'm not at all familiar with C++ or UE4 in general, so I imagine this really isn't difficult to fix, but I'm having a little trouble. I'm following this (https://wiki.unrealengine.com/Oculus_Rift_Separate_View) tutorial to try and achieve the 'true first person' view for the player. It's been fine up to the 'YourCharacter.h' tab. I'm not sure of the syntax for global variables, and when I just paste
in, I get the following errors when I try to compile and run:
Any help is greatly appreciated! Thanks very much.
I am not sure how you created your class, but the structure of your header file is wrong. When you create a new class, the code in your header file should look something like this:
You would then paste the lines from the tutorial in like this:
As ambershee mentioned, C++ is very powerful, but it also assumes you have a very good idea of what you are doing. It is not very forgiving. If you are not familiar with C++, I would recommend starting with something simple and building on that. It doesn't take long to learn C++, but it will take years to master it.
Edit For clarification, some parts of this structure are unique to Unreal Engine 4. Creating a standard C++ class will not work for you in this case. However, if you create a class through the Editor by using File -> Add Code to Project, you will be presented with a class creation "wizard" that will provide you with a .h and .cpp file for a new class that already has the basic structure needed to create a new class in UE4.
answered May 29 '14 at 11:09 PM
You have no class definition (should be created for you automatically when you add code through the editor).
To me this indicates that you have no familiarity with C based languages at all - C++ is powerful, but will give you a lot of opportunity to really break things and cause yourself a lot of frustration whilst not getting anywhere. I would very strongly recommend at least picking up a book covering the basics and working through it if you intend to start programming and want to achieve anything.
I have a copy of the first edition of this book and it is quite reasonable: http://www.amazon.com/Beginning-C-Through-Game-Programming/dp/1435457420/ref=sr_1_1?ie=UTF8&qid=1401403762&sr=8-1&keywords=beginning+c%2B%2B+game+programming
You need to create a class like this:
answered May 29 '14 at 10:51 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here