For the first time, I am trying to write a program under Linux UBUNTU using gcc and I get some compilation results on one module that I hope somebody would be able to explain to me what I am doing wrong.
The command line I am using (with the redirection to a file) is:
sources/Timer.cpp:27:2: error: ‘Timer’ does not name a type; did you mean ‘time’?
Timer::Timer ( void )
^~~~~
time
sources/Timer.cpp:52:2: error: ‘Timer’ does not name a type; did you mean ‘time’?
Timer::~Timer ( void )
^~~~~
time
sources/Timer.cpp:63:2: error: ‘Timer’ does not name a type; did you mean ‘time’?
Timer::Start ( void )
^~~~~
time
sources/Timer.cpp:80:2: error: ‘Timer’ has not been declared
Timer::getElapsedSeconds ( void )
^~~~~
sources/Timer.cpp: In function ‘double RD_Game::getElapsedSeconds()’:
sources/Timer.cpp:83:3: error: ‘m_LastTime’ was not declared in this scope
m_LastTime = SDLGetPerformanceCounter ();
^~~~~~~~~~
... followed errors rejecting all the class data members suppressed
Those inclusions in the source are very foreign to me... If you're using gcc to compile c++ source code, shouldn't you also be linking the standard c++ library? gcc -lstdc++ -std=c++11
Are you also using SDL? If so, I think you should be linking the SDL libraries as well...
@fiji885: The header "common.h" included in "Timer.ccp" include the necessary c++ libraries as well as the declaration of the class "Globals". I did not include because of the message limitations (9000 chars).
Also, a friend told me that I should not use "../headers/" but add it to gcc option (-I headers). Only, I compiled other class modules and the main without problems. So, the class in "Timer.h" compiles without errors with the definition module.
Well, as Duthomhas already mentioned, did you fix your namespace? Capitalization matters... One of them is RD_Games and the other is RD_GAMES.
LeLorrain wrote:
Only, I compiled other class modules and the main without problems.
Are you compiling them one by one into object files, and then linking them all together in the end? I just ask this because I have never compiled a main program without compiling all the other needed components first. I'm not even sure if you can do that.
@fiji885: Thanks, I changed it and the module compile without error! I could have read the code 1000 time and I would not have seen it. When I worked, we always had a colleague read our code to detect this king of errors!