You are confused, I’m not a C++ developer, but the function call doesn’t need the type of parameter “std::vector<RuntimeObject*> & objectList” but just “objectList”, and you are doing a call from a .h file when victor said
By the way you forgotten the semicolon after the function call. Try to do some C++ programs outside GD to know a bit about it ![:wink: :wink:](https://forum.gdevelop.io/images/emoji/apple/wink.png?v=12)
Again, not a C++ developer, but: “for unsigned int a = 1;a<objectList.size();a++)” doesn’t looks good, maybe a missed “(”, and then you use “i” as index instead “a” ![:astonished: :astonished:](https://forum.gdevelop.io/images/emoji/apple/astonished.png?v=12)
Correct me (4ian, victor, …) if I’m wrong, but the idea is something like:
In ObjectTools.h:
void SetPosition(float x, float y, std::vector<RuntimeObject*> & objectList);
So the compiler get the basic information to declare the function (its name, parameters type and return value), I seem to remember that parameters name are not needed, just types.
In ObjectTools.cpp:
void SetPosition(float x, float y, std::vector<RuntimeObject*> & objectList){
for(unsigned int i=0, i<objectList.size(), i++){
objectList[i]->SetX(x);
objectList[i]->SetY(y);
} //return;
}
Add the two files as GD external source files, then in a C++ event add the file in the dependencies and incude the .h file, finally call the function:
SetPosition(100, 50, objectsList);
GD is not intended to be used with sources to be useful (unlike others “non programming” software), sources are there in case you are a developer and want to fully exploit its potential, or show cool things that could be added through demonstration. If you need something that can be only made through C++ and you find it useful, you could make a feature request, or start learning C++ (wich is a good choice, really) ![:slight_smile: :slight_smile:](https://forum.gdevelop.io/images/emoji/apple/slight_smile.png?v=12)