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





Recently uploaded


Oh, also, the article seemed brilliant, had the best depection of @Totalbiscuit I've seen so far. Worth your time.

9 years ago

@Totalbiscuit 's retweet just garnered me some temporary fame, enabling me to plug my game. Too bad I'm capable of feeling shame.

9 years ago

@Totalbiscuit is swedish magazine famous.

9 years ago

Having my first course in MIPS programming this week, couldn't be more excited!

9 years ago Lukas has written a short blog post about his creative process for making levels in Semest!

9 years ago

I don't like puzzels..

10 years ago

Globulous Original Soundtrack -

10 years ago

Lucas has written a bit about our first enemy character on the official #semest blog

10 years ago

Let's kick this thing off

10 years ago

#humblebundle just went one step further in their linux campaign. Making it easier to install game than on windows.

10 years ago
Visual-Structural template by Lucas Orsvärn, support him : Login : Powered by "The surplus morality of 4chan".