User forums > Help
How to setup for G++
DanW_58:
Many thanks, gentlemen; I will do so.
Suryavarman:
From CB you can create a new empty project and compare it with your project.
DanW_58:
I just did; OpenGL project wizard; and this time I did not rename my main file; played it safe.
But I was getting a most mysterious compiler problem, telling me that 'class' was an unknown type..
Just realized the main file that was created is "main.c"... :(
Why?!!!
And now if I rename it to CPP it's going to break everything again?
DanW_58:
Never mind; I deleted the files created, ran the wizard again, thinking it might have a hidden button to select language; there was no such thing...
So I removed file main.c from the project, and added DL3D.cpp, as well as the other file, num_repr.cpp, and it compiles.
What I get now is,
--- Code: ---/usr/bin/ld: obj/Debug/DL3D.o: in function `main':
/home/dd/DL3D/DL3D.cpp:243: undefined reference to `num_repr<unsigned char>::init(int, int, int, int, int, int, int, int)'
/usr/bin/ld: /home/dd/DL3D/DL3D.cpp:245: undefined reference to `num_repr<unsigned char>::num_totalbits()'
/usr/bin/ld: /home/dd/DL3D/DL3D.cpp:241: undefined reference to `num_repr<unsigned char>::~num_repr()'
/usr/bin/ld: /home/dd/DL3D/DL3D.cpp:241: undefined reference to `num_repr<unsigned char>::~num_repr()'
collect2: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 2 second(s))
5 error(s), 5 warning(s) (0 minute(s), 2 second(s))
--- End code ---
... all of which functions ARE well defined in num_repr.cpp and declared in the included header num_repr.h; so I think there's still a problem with linker setup.
Maybe it thinks it is linking C instead of C++?
EDIT: Both files are actually compiled; I see DL3D.o and num_repr.o in the obj folder; but somehow it says 'undefined'...
Suryavarman:
Do you have write the template core functions ?
--- Code: ---typename<T>
num_totalbits<T>::num_totalbits()
{
}
--- End code ---
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version