My code has only one cpp file: main.cpp, and three templated classes, let's call them MyClass1, MyClass2 and MyClass3. All these classes have a header file h and an implementation file inl. MyClass1 uses MyClass2 and MyClass3, thus include their headers as well.
In Red Hat linux, using g++, my makefile looks like the following:
program.exe: main.o
g++ -std=gnu++0x main.o -o program.exe
main.o: main.cpp MyClass1.h MyClass1.inl MyClass2.h MyClass2.inl MyClass3.h MyClass3.inl
g++ -c -std=gnu++0x main.cpp -o main.o
clean:
rm -rf program.exe main.o
However, for each and every method in my three classes, I get the error expected constructor , destructor, or type conversion before ..., where ... is the return type of the method.
Oddly enough, the exact same code compiles just fine with Visual Studio 2015. Any ideas on what might be going on?
I know I might be giving too few information, but I do that since I can't disclosure the real code. If any of you have an idea on what exact parts I could show, then I will gladly bring them here changing names and hidding the methods' implementation.
Aucun commentaire:
Enregistrer un commentaire