Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Stratoukos

macrumors member
Original poster
Jul 15, 2008
51
0
Lately, Xcode started displaying, in one of my projects, every error I make three times. The project is a C++ command line tool. For example if I write:
Code:
int i = "asd";
it should display 1 error for assigning a const char* to an int and 1 warning for the unused variable. Instead I get 3 errors for the assignment and 3 warnings for the unused variable(screenshot). It's not a big deal, since when I fix any errors it builds normally and it only affects this project, but if it's something easy I would like to fix it.

Thanks!
 

Attachments

  • TripleErrors.png
    TripleErrors.png
    63.1 KB · Views: 104
Are you building 3-way FAT? If so, then each file is compiled 3 times, resulting in 3 times the errors.
 
Are you building 3-way FAT? If so, then each file is compiled 3 times, resulting in 3 times the errors.

Yes, that's it. I didn't think of fat binaries, because building 3-way fat binaries is the default and every other project reports each error once. The reason that I get triple errors in this one is that I'm not making debug builds but release. I usually build in debug configuration while developing and make a release build when I'm done, and since there are no errors when I'm done I never noticed before. Because of a bug in Xcode (something with fstream), I can't make debug builds and i noticed the triple errors.

Thanks.
 
What kind of bug is preventing you from making a debug build?

I have a file that has a series of doubles separated by spaces/newlines that I want to read from. This code:

Code:
#include <iostream>
#include <fstream>
#define SIZE 2000

int main(argc, *argv[]) {
    ifstream file("filename", ios::in);
    double d[SIZE];
    for (int i=0; i<SIZE; i++) {
        file>>d[i];
        std::cout<<d[i];
    }
}

would print the correct values when compiled in release or from g++ in terminal, but it would only print zeros when compiled in debug.

Here is where I read that it's a bug. There is also a fix, but since it's only an assignment for my university I just flipped the switch to release and kept working.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.