how to convert GNU C files to visual C

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • buff
    New Member
    • Nov 2006
    • 3

    how to convert GNU C files to visual C

    hi,
    I want to know how to convert gnu c code to visual c, the coding is a huge one, congaing folders which contain some header files and .C files. should i make the same folder structure in visual c environment?, should i do coding changes.?
    thank you
  • sivadhas2006
    New Member
    • Nov 2006
    • 142

    #2
    Hi,

    First try to add the GNU C files into the visual C++ environment.
    If you faced any linking problems just post it.

    We can try to solve that.

    Regards,
    M.Sivadhas.

    Comment

    • buff
      New Member
      • Nov 2006
      • 3

      #3
      Originally posted by sivadhas2006
      Hi,

      First try to add the GNU C files into the visual C++ environment.
      If you faced any linking problems just post it.

      We can try to solve that.

      Regards,
      M.Sivadhas.
      thank you Sivadhas, so I tried to include the files, there are folders too, should i create the folders with the same name? also there is another problem unistd.h header file is not in visual C++ so i download the code and include it but it also failed.
      "Cannot open include file: 'unistd.h': No such file or directory
      Error executing cl.exe."

      Above error is displayed, so please help me on this.

      Thank you

      Comment

      • sivadhas2006
        New Member
        • Nov 2006
        • 142

        #4
        Hi,

        Can I know where you copyied the 'unistd.h' file.
        And also try both syntax.

        Code:
        #include "unistd.h"
        or
        #include <unistd.h>
        All the best...

        Regards,
        M.Sivadhas.

        Comment

        • Banfa
          Recognized Expert Expert
          • Feb 2006
          • 9067

          #5
          Originally posted by buff
          there is another problem unistd.h header file is not in visual C++ so i download the code and include it but it also failed.
          This is not a good idea, the functions declared in that file will likely not be present in VC++. All you are doing is shifting the error from the compiler to the linker and it is actually harder to locate linker problems.

          Better would be to edit the code to remove the places were unistd.h is included and then deal with the compiler errors that result.

          Comment

          • horace1
            Recognized Expert Top Contributor
            • Nov 2006
            • 1510

            #6
            Originally posted by buff
            thank you Sivadhas, so I tried to include the files, there are folders too, should i create the folders with the same name? also there is another problem unistd.h header file is not in visual C++ so i download the code and include it but it also failed.
            "Cannot open include file: 'unistd.h': No such file or directory
            Error executing cl.exe."

            Above error is displayed, so please help me on this.

            Thank you
            as a first step you could use Cygwin (which includes unistd.h and much of its functionality) under Windows. However, this is not recommended for long term development (rather like running Windows programs using wine under Linux).

            You can then identify the Unix specific functions and remove them if possible.

            Comment

            • buff
              New Member
              • Nov 2006
              • 3

              #7
              thank you all who are trying 2 help me. but i still couldn't complete it. there is a makefile in the c source files(i don't know much about it, i only know that it helps to compile the code in GNU c ) how can i deal with that in visual c++

              thank you

              Comment

              • Banfa
                Recognized Expert Expert
                • Feb 2006
                • 9067

                #8
                Originally posted by buff
                thank you all who are trying 2 help me. but i still couldn't complete it. there is a makefile in the c source files(i don't know much about it, i only know that it helps to compile the code in GNU c ) how can i deal with that in visual c++

                thank you
                Ignore it, just create a new Visual Studio project.

                And makefiles or project files just tell the current platform how to compile and link the program. Now a lot of makefile language is common between platforms but not all of it, unless specifically desigened to be portable to another platform it is best to treat the make file as part of the platform it was designed to run on. i.e. don't run it on the new platform.

                Comment

                Working...