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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

UFUNCTION syntax errors in visual studio 2015

So I've tried googling the answer to this for 2 days now and the documentation on the website isnt being helpful. So my problem is this:

I'm trying to make a simple blueprint function in c++ I've followed all the tutorials and it still gives me an error and I can''t work out why its happening.

SteamAPI.h

 // Fill out your copyright notice in the Description page of Project Settings.
 
 #pragma once
 
 #include "Kismet/BlueprintFunctionLibrary.h"
 #include "SteamAPI.generated.h"
 
 /**
  * 
  */
 UCLASS()
 class SUNK_API USteamAPI : public UBlueprintFunctionLibrary
 {
     GENERATED_BODY()
 
     UFunction(BlueprintCallable, Category = "Steam")
     static void foo();
     
 };

SteamAPI.cpp

 // Fill out your copyright notice in the Description page of Project Settings.
 
 #include "Sunk.h"
 #include "SteamAPI.h"
 
 void USteamAPI::foo()
 {
 
 }
 

Finally the errors that visual studio keeps giving me are:

 Error    C2059    syntax error: ')'    Sunk    d:\sunk\source\sunk\SteamAPI.h    16    

 Error    C2143    syntax error: missing ')' before ','    Sunk    d:\sunk\source\sunk\SteamAPI.h    16    

 Error    C2144    syntax error: 'void' should be preceded by ';'    Sunk    d:\sunk\source\sunk\SteamAPI.h    17
 
 Error    C2664    'UFunction::UFunction(const UFunction &)': cannot convert argument 1 from 'const char [6]' to 'const FObjectInitializer &'    Sunk    d:\sunk\source\sunk\SteamAPI.h    17    

 Error    C2039    'foo': is not a member of 'USteamAPI'    Sunk    D:\Sunk\Source\Sunk\SteamAPI.cpp    6    

 Error    C2143    syntax error: missing ')' before ','    Sunk    D:\Sunk\Source\Sunk\SteamAPI.h    16    

 Error    C2059    syntax error: ')'    Sunk    D:\Sunk\Source\Sunk\SteamAPI.h    16    

 Error    C2144    syntax error: 'void' should be preceded by ';'    Sunk    D:\Sunk\Source\Sunk\SteamAPI.h    17    

 Error    C2664    'UFunction::UFunction(const UFunction &)': cannot convert argument 1 from 'const char [6]' to 'const FObjectInitializer &'    Sunk    D:\Sunk\Source\Sunk\SteamAPI.h    17
 
 Error        Failed to produce item: D:\Sunk\Binaries\Win64\UE4Editor-Sunk-6194.dll    Sunk    D:\Sunk\Intermediate\ProjectFiles\ERROR    1    

 Error    MSB3073    The command ""C:\Program Files (x86)\Epic Games\4.10\Engine\Build\BatchFiles\Build.bat" SunkEditor Win64 Development "D:\Sunk\Sunk.uproject" -rocket -waitmutex -2015" exited with code -1.    Sunk    C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets    37    
 


Thanks in advance.

Product Version: UE 4.10
Tags:
more ▼

asked Feb 11 '16 at 10:54 AM in C++ Programming

avatar image

techno9487
3 1 3

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

1 answer: sort voted first

Hi techno9487. Just replace Ufunction to UFUNCTION in SteamAPI.h. And all will work.

more ▼

answered Feb 11 '16 at 11:06 AM

avatar image

Anatoliy
323 12 8 20

avatar image techno9487 Feb 11 '16 at 12:02 PM

Cheers! Seems to work OK with the tutorials now.

(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