I was wondering if it was allowed by standard C++ to split the implementation of a class in two different cpp files, this mean implementing some methods in one cpp file and other methods in another. I need to use this because I use a cross compiler (which is compatible with the standard compiler) to compile some methods, and I would like to compile the other methods with the standard compiler.
I tried and it seemed to work, but one day I had a problem with the linker which couldn't link a method. That's why I am asking if someone has already use this or if there is some other way to do it (using "extern" keyword or something else)
I was wondering if it was allowed by standard C++ to split the implementation of a class in two different cpp files, this mean implementing some methods in one cpp file and other methods in another.
Doesn't matter as long as the linker has all necessary methods when all is said and done.
I tried and it seemed to work, but one day I had a problem with the linker which couldn't link a method.
Perhaps the compilers aren't that compatible after all...
I need to use this because I use a cross compiler
You're trying to link object files together that were compiled for different systems?
You should elaborate...
I need a cross compiler because I want some code to be executed on the graphical card.
Doesn't matter as long as the linker has all necessary methods when all is said and done.
Does it also work if one method from one file call a method from the other file ? Isn't it possible that the compiler suppose that the method will be compiled in the same object file which will generate problems at link time ?
Does it also work if one method from one file call a method from the other file ? Isn't it possible that the compiler suppose that the method will be compiled in the same object file which will generate problems at link time ?
No... libraries could not exist if the compiler required all referenced functions to be in the same module. The linker is what brings them all together.
Symbols are externally visible by default unless you declare them as static.