A Conversation for The H2G2 Programmers' Corner

visual c++ and unix

Post 1

Dogster

Does anyone have any experience of simultaneously developing a project using visual c++ and unix? I've solved what should be the hard problems involved (i.e. the code actually compiles and runs on both platforms), but I have an irritating niggly little problem. Unix and Windows use slightly different file formats for text. When I open code written on a Unix computer in msvc all the alignments go pear shaped because msvc has different tab sizes and likes to keep the tabs rather than expand them to spaces. When I compile code on Unix written in windows it keeps telling me there is no newline at the end of the file. Also, the files edited in windows have this irritating ^M symbol at the end of every line. Grrrr. I'm using emacs and xemacs on the unix computers, and the visual c++ editor on the windows one. Is there any way to make this easy or is it always going to be a problem?


visual c++ and unix

Post 2

Dogster

My first thought is to write a perl script that converts CR+LF to whatever it is that unix uses (it's either just CR or just LF I can't remember which), and vice versa. Also, I could set it up so that tabs are converted correctly as well. Still, it would be nice to find an easier solution, anyone know of one?


visual c++ and unix

Post 3

xyroth

as you have got unix, look up the utilities "dtou" and "utod" which deal with converting from one format to the other.

also, if you don't need the microsoft extensions, consider using djgpp as your windows compiler, as it is a translation of gcc into a dos/windows friendly format.

this should stop you having to convert backwards and forwards.

djgpp is at http://www.delorie.com/djgpp/


visual c++ and unix

Post 4

Peet (the Pedantic Punctuation Policeman, Muse of Lateral Programming Ideas, Eggcups-Spurtle-and-Spoonswinner, BBC Cheese Namer & Zaphodista)

If you're seeing ^M (Control-M, aka CR) on screen, that would suggest that U*IX is just using the LF at the end of the line. smiley - geek


visual c++ and unix

Post 5

MaW

Yes, that's all UNIX uses.

If you have a sufficiently recent version of Emacs though, it should be clever enough to pick up that it's a DOS file and switch modes accordingly. Mine does anyway. It's possible it may be one of Emacs' many configuration settings


Key: Complain about this post

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more