none
how to Convert GNU C Linux code to VC++ windows code

    Question

  • Hi All,
              I am a .net developer and don't have much experience with VC++ or c++, I've got a code written and compiled in GNU C at Linux.
    And i want to convert it and compile with VC++ [VS 2008 / 2005]

    I inspected all of the folders and found that they all have a makefile, while the root folder has a makefile, and a makefile.cfg, config.make
    I tried finding how to convert the make to nmake, but had not success with it.

    Please help.

    Regards

    Monday, June 16, 2008 4:48 AM

Answers

  • Learn how to put a Visual Studio project together, it isn't hard.
    Hans Passant.
    • Marked as answer by Yan-Fei Wei Friday, June 20, 2008 9:39 AM
    Monday, June 16, 2008 12:51 PM
    Moderator
  • Hi,

     

    Firstly, you can tell a project to refer to external libraries through following steps.

    1.    Add the directory where your external library resides to “Configuration Properties > Linker >General >Additional Library Directories”.

    2.    Add the library file name as additional dependencies of your project. To do this, you can add the library file name to “Configuration Properties > Linker >Input >Additional Dependencies” or use the “#pragma” directive. For example, 

    #pragma comment (lib, "yourlibname.lib")

     

    Secondly, the files in $(VCInstallDir)\Include are standard C/C++ headers files. Generally, you need to include some of them in your program.

     

    Thirdly, based on my knowledge, there isn’t any tool to convert gcc based Makefile to Visual C++ makefile. You need to make some modifications, such as compiler settings, directories settings and so on. Besides, if your Linux C code makes system calls, as system calls of Linux and Windows are different, you may need to make some modifications to your Linux C code. Here are tips and guidelines on porting from UNIX to Win32, hope it helps!

    http://msdn.microsoft.com/en-us/library/y23kc048.aspx


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by Yan-Fei Wei Friday, June 20, 2008 9:38 AM
    Thursday, June 19, 2008 7:34 AM

All replies

  • Learn how to put a Visual Studio project together, it isn't hard.
    Hans Passant.
    • Marked as answer by Yan-Fei Wei Friday, June 20, 2008 9:39 AM
    Monday, June 16, 2008 12:51 PM
    Moderator
  •  oh! is it ?
    well there are lots of dependecies in the code; and i must say lots of them [around 8 libraries are referenced].
    anyways i started creating projects, and adding files [.h,.hh and .c, .cc] files to each project, and gave references, but i am having errors related to references like
    cannot open include file -  though the file is present in the same dir
    i the changed the include statement to have double quotes in it.
    then there are files, which i really don't know from where they are coming, later i found that most of them were in <installationdir>/vc8/include folder so i referenced it as well.

    i don't know if it's the right way to do it...but it's time consuming for sure; all i was looking for is if there is
    a utility to convert make files [linux, gcc based] to nmakefile for VC++ [windows].

    that's it...

    Regards

    Tuesday, June 17, 2008 7:55 AM
  • Hi,

     

    Firstly, you can tell a project to refer to external libraries through following steps.

    1.    Add the directory where your external library resides to “Configuration Properties > Linker >General >Additional Library Directories”.

    2.    Add the library file name as additional dependencies of your project. To do this, you can add the library file name to “Configuration Properties > Linker >Input >Additional Dependencies” or use the “#pragma” directive. For example, 

    #pragma comment (lib, "yourlibname.lib")

     

    Secondly, the files in $(VCInstallDir)\Include are standard C/C++ headers files. Generally, you need to include some of them in your program.

     

    Thirdly, based on my knowledge, there isn’t any tool to convert gcc based Makefile to Visual C++ makefile. You need to make some modifications, such as compiler settings, directories settings and so on. Besides, if your Linux C code makes system calls, as system calls of Linux and Windows are different, you may need to make some modifications to your Linux C code. Here are tips and guidelines on porting from UNIX to Win32, hope it helps!

    http://msdn.microsoft.com/en-us/library/y23kc048.aspx


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by Yan-Fei Wei Friday, June 20, 2008 9:38 AM
    Thursday, June 19, 2008 7:34 AM