View Full Version : Xcode reports triple errors
Stratoukos
Dec 10, 2009, 09:24 AM
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:
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 (http://att.macrumors.com/attachment.php?attachmentid=206661&stc=1&d=1260458544)). 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!
kpua
Dec 10, 2009, 09:32 AM
Are you building 3-way FAT? If so, then each file is compiled 3 times, resulting in 3 times the errors.
Stratoukos
Dec 10, 2009, 10:11 AM
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.
kainjow
Dec 10, 2009, 10:55 AM
What kind of bug is preventing you from making a debug build?
Stratoukos
Dec 10, 2009, 03:28 PM
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:
#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 (http://discussions.apple.com/thread.jspa?threadID=2185540&tstart=75) 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.
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.