how do i use a function without calling it from a different class? (i have more files in my project)
i made a test function called dostuff() { } inside some random file outside a class. but when i want to compile i get this:

Error 1 error LNK2005: "void __cdecl dostuff(void)" (?dostuff@@YAXXZ) already defined in YAGP.obj N_MenuButton.obj

9 Years
Discussion Span
Last Post by n3XusSLO

The error makes it sound like you're trying to redefine the function in your main file. You need to declare an instance of a class to use the functions in it.


well thats what i don't want to do. i want to use a function that isn't inside a class. lets say this is the case:

class blbl
some random things, not important now

void foo(some stuff)


i want to use foo in some other .cpp file or whatever. i get this error altough there are no other functions with that name (?)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.