logo
Main

Forums

Downloads

Unreal-Netiquette

Donate for Oldunreal:
Donate

borderline

Links to our wiki:
Wiki

Walkthrough

Links

Tutorials

Unreal Reference

Usermaps

borderline

Contact us:
Submit News
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to get a "hello world" going in C++ (Read 996 times)
[]KAOS[]Casey
Developer Team
Betatester
Offline


nedm

Posts: 3199
Joined: Aug 7th, 2011
Gender: Male
How to get a "hello world" going in C++
Aug 25th, 2015 at 6:27am
Print Post  
Links:

fixed Unrealgold header link: http://www.klankaos.com/UnrealGoldFixedHeaders.rar (This may not work on VS2013+!!!) (You will need to modify files and the project to get this to work)

VS2008 project that you can upconvert:  http://www.klankaos.com/BlankSolutionVS2008.zip

BlankProject UCC compilable zip file: http://www.klankaos.com/BlankProjectUC.zip

What you need:

Visual Studio 2008-2013 (2015 works but prints way too many warnings that aren't actually problems...) (Technically 2003/5 work too but this project is made for VS2008 and cant be downconverted easily.. thanks M$)

Public headers (227i if possible.. its easier that way, trust me.)

The ability to unzip and copy paste files





Install your headers to your Unreal main folder: (this is largely preference -- but it's what I do.)

f.e.

c:\unrealgold\227iPublicHeaders\Core
c:\unrealgold\227iPublicHeaders\Engine
c:\unrealgold\227iPublicHeaders\{etc.}

Unzip the supplied BlankSolutionVS2008 to c:\unrealgold\227iPublicHeaders\ such that it reads as

c:\unrealgold\227iPublicHeaders\BlankSolutionVS2008\inc
c:\unrealgold\227iPublicHeaders\BlankSolutionVS2008\src

Unzip the supplied BlankProjectUC to c:\unrealgold\ such that it reads as follows:
c:\unrealgold\BlankProject
c:\unrealgold\BlankProject\Classes

Edit your 227i system Unreal.ini to append EditPackages=BlankProject

Run in command prompt "ucc make -nobind"

make sure BlankProject.uc compiles correctly:

Code
Select All
E:\UnrealGold\System>ucc.exe make -nobind
--------------------Core--------------------
--------------------Engine--------------------
--------------------Editor--------------------
--------------------Fire--------------------
--------------------IpDrv--------------------
--------------------UWindow--------------------
--------------------UnrealShare--------------------
--------------------UnrealI--------------------
--------------------IpServer--------------------
--------------------UBrowser--------------------
--------------------ALAudio--------------------
--------------------UMenu--------------------
--------------------UWebAdmin--------------------
--------------------Emitter--------------------
--------------------UPak--------------------
--------------------UDSDemo--------------------
--------------------BlankProject--------------------
Analyzing...
Parsing BlankActor
Compiling BlankActor
Importing defaultproperties for BlankActor
0 warning(s) 




Open BlankProject.sln in visual studio and mash the compile button as hard as you can -- hold onto your butts.

If it works, you should see an output like:

Code
Select All
1>  BlankSolution.vcxproj -> C:\UnrealGold\227i_PublicHeaders\BlankSolutionVS2008\.\Lib\BlankProject.dll 



Now go to that path, "C:\UnrealGold\227i_PublicHeaders\BlankSolutionVS2008\.\Lib\" and copy BlankProject.dll to your System folder.

Run unreal, open any level, window your game, type "showlog" as a command and summon "BlankProject.BlankActor".

You should see this in your log

Code
Select All
ScriptLog: Fabricate BlankProject.BlankActor
Log: Bound to BlankProject.dll
Log: 10475.0ms Loading: Package BlankProject
Log: Checking package BlankProject
Log: Hello World! S=Test,I=888 



Congrats, you got your first native mod compiled and working!
  
Back to top
 
IP Logged
 
[]KAOS[]Casey
Developer Team
Betatester
Offline


nedm

Posts: 3199
Joined: Aug 7th, 2011
Gender: Male
Re: How to get a "hello world" going in C++
Reply #1 - Aug 25th, 2015 at 6:30am
Print Post  
To come in this post:

how to get BlankSolution to compile for UnrealGold and UT (I need to download older compilers...)
  
Back to top
 
IP Logged
 
han
Global Moderator
Unreal Rendering Guru
Developer Team
*****
Offline


Oldunreal member

Posts: 565
Location: Germany
Joined: Dec 10th, 2014
Gender: Male
Re: How to get a "hello world" going in C++
Reply #2 - Oct 22nd, 2015 at 8:08pm
Print Post  
It might be worth to mention that the problem with newer compilers basically breaks down to just a few easy to solve issues:

wchar_t is by default treated as a build in type. You need to disable it. See:
https://msdn.microsoft.com/en-us/library/vstudio/dh8che7s(v=vs.120).aspx

Conformance in for loop scope is forced. You need to disable that too or fix the few affected lines by hand. See:
https://msdn.microsoft.com/en-us/library/vstudio/84wcsx8x(v=vs.120).aspx

UnTemplate.h misses (quite a few) typename keywords. You will get a lot of errors about UnTemplate.h, you basically need adjustments like this:
Code
Select All
		// Old.
		TPair( TTypeInfo<TK>::ConstInitType InKey, TTypeInfo<TI>::ConstInitType InValue )
		: Key( InKey ), Value( InValue )
		{}

		// Add typename keyword.
		TPair( typename TTypeInfo<TK>::ConstInitType InKey, typename TTypeInfo<TI>::ConstInitType InValue )
		: Key( InKey ), Value( InValue )
		{}
 



When working on porting ALAudio to Nerf I got link errors about some TArray<BYTE> related functions missing. Following workaround fixed it.:
Code
Select All
//
// Sound data.
//
#if defined(_MSC_VER) && _MSC_VER>1200
class FSoundData : public TLazyArray<BYTE>
#else
class ENGINE_API FSoundData : public TLazyArray<BYTE>
#endif
{
public:
	USound* Owner;
	void Load();
	FLOAT GetPeriod();
	FSoundData( USound* InOwner )
	: Owner( InOwner )
	{}
};
 

  

HX on Mod DB. Revision on Steam.
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint
Bookmarks: del.icio.us Digg Facebook Google Google+ Linked in reddit StumbleUpon Twitter Yahoo