Include header path change from Windows to Linux

前端 未结 6 974
终归单人心
终归单人心 2020-12-10 05:08

I\'m porting an application written in C++ from Windows to Linux. I have a problem with the header files path. Windows uses \\ and Linux uses /. I

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-10 06:13

    Always use forward slashes in #include directives. Some operating systems / compilers require it, and Windows / Visual Studio is smart enough to handle it correctly.

    Since your starting with Windows code, I'm assuming that you have Visual Studio. Use the find and replace dialog and create a regular expression that will do the substitution for you. Run the find and replace on all files.

    For example, use something like this:

    #include:b+<{[^\\\>]}\\
    

    for your search expression and

    #include <\1
    

    for the replace expression (warning: untested). Run this on all files until no replacements are made. Then switch the angled brackets to quotes and repeat.

提交回复
热议问题