Small script for fixing #include paths

Sat, 06 October, 2012

I've been spending some time trying to port a game written in C++ for windows to BSD/Linux.

One of the things that usually cause issues is that most Windows compilers accept include statements that looks like this

#include path\to\file

But GCC prefers it like so

#include path/to/file

Instead of manually going through each file to fix this issue i wrote a quick bourne shell script using grep and sed

This script will affect all files that are in the current folder and down.

It does a rough search looking for all files ending with .h or .cpp and does an in file replace of all back slashes to front slashes where the line begins with #include

This is in no way tested enough, no warranty given. Make sure to only use it on folders that have a backup of some sort.

Reply to Post

Name:
Email:
URI:
two+2:

*

**


Gallery

Recently uploaded

Twitter

Visual-Structural template by Lucas Orsvärn, support him : Login : Powered by "An unusual sense of well being".