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

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

6 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.

6 years ago

@Totalbiscuit is swedish magazine famous. http://t.co/AXA34LeZ

6 years ago

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

6 years ago

http://t.co/OsUrwwhe Lukas has written a short blog post about his creative process for making levels in Semest!

6 years ago

I don't like puzzels.. http://t.co/AsVLA6Lf

6 years ago

Globulous Original Soundtrack - http://t.co/9ctX1sFJ

6 years ago

Lucas has written a bit about our first enemy character on the official #semest blog http://t.co/5eXWx6wz

6 years ago

Let's kick this thing off http://t.co/rZPDEgZQ

6 years ago

#humblebundle just went one step further in their linux campaign. Making it easier to install game than on windows. http://t.co/pnx4LLxh

7 years ago
Visual-Structural template by Lucas Orsvärn, support him : Login : Powered by "Santas lost elves".