amrita
amrita

Reputation: 133

mac file format detected; alternative to Advanced Save options

I've been getting a lot of this error recently in VS 2008 on win 7:

.\StdAfx.cpp : error C4335: Mac file format detected: please convert the source file to either DOS or UNIX format

After some research, the only way to get rid of this error seems to be Advanced Save Options->Line Endings->Windows.

However, this would change the file, and that is not possible at this time.

Are there alternative solutions to modifying the file? Such as some kind of build/project settings?

Thanks

P.S. I've tried the Tools->Options->Environment->Documents->Save documents as unicode... option but that doesn't seem to do anything.

Upvotes: 3

Views: 2393

Answers (2)

Will Dean
Will Dean

Reputation: 39520

There is no way to change the line endings in a file without changing the file. The best you could do is to copy the files (to a new name, or a new location), fixing the line endings in the process, and compile the copies.

You could even automate the whole ridiculous process if you wanted.

The error stems from the fact that lines in text files can be separated in several ways:

 Line 1<CR><LF>Line2 - Windows/DOS/Most Internet protocols
 Line 1<LF>Line 2 - Unix and some Macs
 Line 1<CR>Line 2 - Some Macs

The MS compilers can apparently cope with either of the first two, but not the third.

Some version control systems are notorious for causing newline-related problems, so if you don't know how you got into this mess, that's where I'd look.

Upvotes: 1

rems4e
rems4e

Reputation: 3172

You say you don't want to change the file, but you say you tried to save it in another format. Can you change it or not ? Does something prevents you to set another line ending for a copy of your document ?

Upvotes: 0

Related Questions