Backslash forward slash, cross platform problem?



  • Im very new to this, and im hoping somone here can point me in the right direction.

    I have inherited a project from the guy I took this job over from and have never used qt before. Ive been going through tutorials and its really growing on me. I figured it was about time i tried to tweek this old project a bit but I cant seem to compile it. Im lead to believe it did compile fine on the old guys mac, and I think this is where the problem lies, He developed on a mac and im developing on a pc. The problems Im getting involes the compiler not finding files and when I look deeper I see mixed up back slashes and forward slashes in file names. I cannot find these file names in the source anywhere. there are several which have the same name as a .cpp file but with an .o extention the compiler cant find this and shows the unknown file as /release\file.o

    Any help would be greatly appreciated, It would be great for this app to work on all platforms and hopefully as I get to know more I can get it there.

    Can someone please point me in the right direction.

    Thanks



  • .o files are object-files from gcc compiler. So you will not found them in sources.



  • I suppose you develop on Windows and are using MSYS (or even MinGW, I don't know how it handles paths), so paths in generated files are quite inconsistent most of time. They will work with no problems though. Windows mostly supports / even in its own shell, it was quite a surprise to me.



  • Mixed backward/forward slashes is usually not a problem. Windows handles them pretty OK as it understands urls for local files as well. Also, while the paths are displayed with forward slashes in them, they are converted to backward slashes where necessary.

    If you run into this in your code and you are not sure a library can properly work with the forward slashes, use QDir::toNativeSeparators(). It'll sort it all out for you.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.