Author Topic: Code::Blocks has got some SERIOUS issues!  (Read 17036 times)

Offline Someone1

  • Multiple posting newcomer
  • *
  • Posts: 11
Code::Blocks has got some SERIOUS issues!
« on: September 26, 2012, 11:25:43 pm »
It's not so early anymore, and I'm getting very frustrated due to what time it is.
Please read CAREFULLY what I am writing so I don't have to re-post this again, and again.

I first declared a class, in C++, in another header. The code is as follows:

(This is an INCOMPLETE snippet of my code)
Code
class game{
    struct color{int r,g,b,n;};
    struct screen_color{color c;};
    bool collision (int X, int Y, int x, int y);
    int Time;
};
Then, I decided I wanted to change my class name, but I had used the class name (thus the functions including) in my main.cpp file.

I used Code::Block's "replace" tool to replace all instances of "game" in BOTH my header AND my main (I re-did this twice..).

I then tried to execute my code, but Code::Blocks returned MANY instances of this error:
Code
Expected primary-expression before ‘.’ token
What this means - which you all know - is that it doesn't interpret the class itself which was initialized before (game.collision(...)).

Now. What I did was I changed the class name ONLY!, leaving ALL other instances of the old class name be.
The new class name is game1...

Now, it only returns ONE single error.. That is right, only ONE error... despite having many instances of undeclared class names being used.
This error is:
Code
 expected initializer before '.' token


Now, I ask you, forum, what in the HECK is wrong here? Is it me who's too tired to see the problems in my code? I can't understand why Code::Blocks works the way it does.
It should at the VERY least return multiple errors.. not just ONE.

Offline Someone1

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code::Blocks has got some SERIOUS issues!
« Reply #1 on: September 26, 2012, 11:53:21 pm »
Okay, here's some more troubling news for everyone.
You know, I said it only returns one error, right?

Check this out: when I remove "game1" from my function declaration:
Code
bool game1::collision (int X, int Y, int x, int y)
It returns errors from OUTSIDE OF THIS FUNCTION -- which does NOT relate to the function at all.

What.. the heck is this? If you didn't get that. When I ACTUALLY make an error (Code::Blocks is reporting false errors) in the code, Code::Blocks returns NON-errors.
It returns code which is fine, as faulty...


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Code::Blocks has got some SERIOUS issues!
« Reply #2 on: September 27, 2012, 12:21:04 am »
Probably start by reading this: http://wiki.codeblocks.org/index.php?title=FAQ-General#Q:_What_Code::Blocks_is_not.3F

C++ is not Java, so the rename tool (Code refactoring -> Rename symbols) is useless 99% of the time.
If you've used Search -> Replace in files, then just fix your code and make sure you've used 'whole word' and 'match case'.

For the single error problem - most compilers aren't that smart to show all errors at once.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Someone1

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code::Blocks has got some SERIOUS issues!
« Reply #3 on: September 27, 2012, 01:55:59 pm »
Probably start by reading this: http://wiki.codeblocks.org/index.php?title=FAQ-General#Q:_What_Code::Blocks_is_not.3F

C++ is not Java, so the rename tool (Code refactoring -> Rename symbols) is useless 99% of the time.
If you've used Search -> Replace in files, then just fix your code and make sure you've used 'whole word' and 'match case'.

For the single error problem - most compilers aren't that smart to show all errors at once.
Oh, right. So technically, the lack of errors being displayed properly is not Code::Blocks' issue - it is the underlaying compiler?

I will see to trying to get it fixed again. For whatever reason, when I do fix my class declaration (which is what is returning errors) it still returns errors.. I don't have a clue why.
Again, I will definitely spend some time trying to fix this.

It's very frustrating only receiving one error when you clearly know there's at least more than 30 instances.

Offline Freem

  • Almost regular
  • **
  • Posts: 219
Re: Code::Blocks has got some SERIOUS issues!
« Reply #4 on: September 27, 2012, 02:02:32 pm »
This is not an error returned by C::B, but by your compiler (whatever it is).

It is not possible or hard for us to debug code with so few informations (bigger snippets and copy/paste of the log would be more helpful)... but if you used "search and replace" tool, did not you replace the name in the include directive, without having changed the filename?
Anyway, this is a a programmer error: you made an error in the code, and we can not help with so few lines.

For single error, I would like to complete oBFusCATed: solving an error often highlight other ones.
(This is why I often fix only 5-6 first errors before compiling anew ;) )

Offline Someone1

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code::Blocks has got some SERIOUS issues!
« Reply #5 on: September 27, 2012, 02:11:42 pm »
I am getting extremely frustrated now.

I COMPLETELY removed the declaration of my collision detection function.
When objects collide, they reject each other?

What the heck is going on. Why is it not saving my code properly?

Offline Someone1

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code::Blocks has got some SERIOUS issues!
« Reply #6 on: September 27, 2012, 02:14:17 pm »
This is not an error returned by C::B, but by your compiler (whatever it is).

It is not possible or hard for us to debug code with so few informations (bigger snippets and copy/paste of the log would be more helpful)... but if you used "search and replace" tool, did not you replace the name in the include directive, without having changed the filename?
Anyway, this is a a programmer error: you made an error in the code, and we can not help with so few lines.

For single error, I would like to complete oBFusCATed: solving an error often highlight other ones.
(This is why I often fix only 5-6 first errors before compiling anew ;) )
The problem is not my coding. ALL my instances of calling the class name, and using the member separator (".") are done CORRECTLY!
The problem is (read my comment above), Code::Blocks now turns out to not save my code at all--or, the underlaying compiler doesn't compile?

Yes, literally any changes I make are not compiled.

Okay. Now I completely removed my main function, and it still says it compiles?
« Last Edit: September 27, 2012, 02:16:32 pm by Someone1 »

Offline Someone1

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code::Blocks has got some SERIOUS issues!
« Reply #7 on: September 27, 2012, 02:58:43 pm »
I hope the moderators don't mind the multiple posts.

I followed the correct guide-lines, setting it to show all the build options.
Here is what it gave me:
Code
-------------- Clean: Debug in test12 ---------------

Cleaned "test12 - Debug"

-------------- Build: Debug in test12 ---------------

mingw32-g++.exe -Wall  -g    -I"C:\Users\Franck\Desktop\C++ projects\C++ CodeBlocks projects\test12\" -I"C:\Users\Franck\Desktop\C++ projects\C++ CodeBlocks projects\test12\" -IC:\Users\Franck\Desktop\SDL-1.2.15\include\SDL  -c "C:\Users\Franck\Desktop\C++ projects\C++ CodeBlocks projects\test12\objects.h" -o objects.h.gch
mingw32-g++.exe: projects\C++: No such file or directory
mingw32-g++.exe: CodeBlocks: No such file or directory
mingw32-g++.exe: projects\test12": No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
Now, I MAY not be the brightest bulb around, but I think there's a problem here.
Why does it not recognize mingw32? I was coding perfectly fine yesterday, until around 21:00 'o clock when it started malfunctioning.

Offline Phenom

  • Multiple posting newcomer
  • *
  • Posts: 57
Re: Code::Blocks has got some SERIOUS issues!
« Reply #8 on: September 27, 2012, 03:12:28 pm »
I think your problem are the spaces in the paths.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Code::Blocks has got some SERIOUS issues!
« Reply #9 on: September 27, 2012, 03:15:19 pm »
Your posts miss some absolutely necessary informations:
Which version of C::B do you use ?
Which version of gcc do you use ?

Older revisions of gcc sometimes have problems with paths, that continue spaces.
That seems to be your issue (at least the issue shown from your log).

Offline Someone1

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code::Blocks has got some SERIOUS issues!
« Reply #10 on: September 27, 2012, 03:28:26 pm »
Your posts miss some absolutely necessary informations:
Which version of C::B do you use ?
Which version of gcc do you use ?

Older revisions of gcc sometimes have problems with paths, that continue spaces.
That seems to be your issue (at least the issue shown from your log).
Oh, I completely forgot!
Using Code::Blocks 10.05
Gcc is 4.4.1.
If I go under Code::Blocks->Plugins->Compiler...(drop down)->Information(tab), it says version 0.99???
« Last Edit: September 27, 2012, 03:32:01 pm by Someone1 »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Code::Blocks has got some SERIOUS issues!
« Reply #11 on: September 27, 2012, 04:46:43 pm »
Remove the spaces in the paths and it will work.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Someone1

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code::Blocks has got some SERIOUS issues!
« Reply #12 on: September 27, 2012, 05:08:00 pm »
Remove the spaces in the paths and it will work.
Thanks, it compiles and runs!
But, now I get this, which is pretty odd (see attachment).
Another attachment. Oh, boy. This is fun!
« Last Edit: September 27, 2012, 05:11:35 pm by Someone1 »

Offline Someone1

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code::Blocks has got some SERIOUS issues!
« Reply #13 on: September 27, 2012, 06:04:59 pm »
Okay, this is it. I am installing a new IDE. This is not the first time I've had these kind of problems.

I just tried switching around the type of application under the project's attributes, setting it to GUI application.
It then returned an error which it had not returned before.
I switched back to console application, and BAM--it still shows up.
Code
undefined reference to `WinMain@16'

I can not fathom how it should be this difficult to control an IDE. I mean, the time it takes to fix these kind of issues... I've spend many days (before) and have not been able to solve any of these mysterious occurrences.
Moreover, the documentation only provides help for SOME of the issues--NOT those I have run into this far.

If anyone of you know of the problem I am experiencing - despite my lack of proper explanation - then please, let me know.
The place I work at requires that we use Code::Blocks.. for some odd reason. I have been told to finish a project within a short month or so. and with all these constant issues - I am likely to not finish it.

A last thing, how is it that the last release of Code::Blocks is from 2010 (according to the websites own data)?
With all these issues - which I am not alone to experience - you'd think we'd get a proper release.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Code::Blocks has got some SERIOUS issues!
« Reply #14 on: September 27, 2012, 06:24:19 pm »
A last thing, how is it that the last release of Code::Blocks is from 2010 (according to the websites own data)?
With all these issues - which I am not alone to experience - you'd think we'd get a proper release.

Not everybody has theses issues.
The 10.05 release works fine, even if it is limited in some points.

The nightly builds have some more functionality and some others improved a lot.

But your issues are either usermade or are related to a screwed up system.

Offline Freem

  • Almost regular
  • **
  • Posts: 219
Re: Code::Blocks has got some SERIOUS issues!
« Reply #15 on: September 28, 2012, 09:59:27 am »
the undefined ref is quite a common error, I think you should know that.
Do you have a "int main()" implementation function if you are trying to make a console program, or are you sure to link with the good dll if you are creating a GUI software?
I am not sure, but I think I had the same error when not linking against mingw32, many times ago.

This is a problem of the code you wrote or what you made in project's settings.
An easy way to help us to know what it exactly is, is by giving us anew your compiler logs.

Honestly, each time I installed it, and I made such operations many times, on both windows and debian, I never had so many problems.