error on non existing line

May 19, 2012 at 5:48pm
Hi,

This post is in addition to my other one about a bug.
I am getting an error that is supposedly on line 30 of ui.h. However I only have 18 lines in that file. The error is actually on ui.cpp line 13. Adding the number of lines from ui.h -1 to the ui.cpp i find the error place.
Does anyone know why its doing that? shouldnt it say ui.cpp line 13?

let me know if u need more information because Ive never seen this happen and dont even know where to start to fix it
Last edited on May 19, 2012 at 5:49pm
May 19, 2012 at 5:57pm
What is the exact error message and what compiler do you use? It's also helpful if you could post the code.
May 19, 2012 at 6:13pm
http://www.cplusplus.com/forum/general/71397/

its all the same information im just asking about a different problem in that thread.

Im just curious to know why g++ would "attach" the cpp at the end of the .h when it never did that before...
May 19, 2012 at 6:23pm
If you have a line like this #include "ui.cpp" on the very end of you ui.h, the compile basicly inserts the contents of ui.cpp in ui.h.
EDIT: Look below!
Last edited on May 19, 2012 at 6:31pm
May 19, 2012 at 6:31pm
OOOOOOOOOOh!!!!!!!!! I get it now! I've seen your other post and now I get it!!!!!!!!!
Becouse all in your ui.cpp are definitions for the functions in ui.h, those lines add up to your ui.h!!
May 19, 2012 at 6:42pm
but usually when i get an error on the cpp it tells me ui.cpp it just started doing that a couple days ago o0
May 20, 2012 at 1:06pm
This doesn't sound right? Are you sure you are compiling the correct file? I'm asking because it has happened that people think they compile one file but in the end it turns out they compiled some other file, often in a different directory.
Topic archived. No new replies allowed.