How to compile C program developed with Microsoft Visual C/C++ 6.0 in Linux system

Yang, Fen - BLS CTR 0 Reputation points
2025-12-12T13:42:37.8166667+00:00

I need to compile C program developed with Microsoft Visual C/C++ 6.0 in Linux system?

Thanks,

Fen

Developer technologies | C++
Developer technologies | C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Q&A Assist
    2025-12-12T13:43:46.82+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To compile a C program developed with Microsoft Visual C/C++ 6.0 on a Linux system, you will need to follow these general steps:

    1. Porting the Code: Since Visual C++ may use Windows-specific APIs, you will need to refactor your code to remove or replace any Windows-specific calls with standard C or POSIX-compliant code. This may involve using libraries that are available on Linux.
    2. Install a C Compiler: Ensure you have a C compiler installed on your Linux system. Common options include GCC (GNU Compiler Collection) or Clang. You can install GCC using your package manager, for example:
         sudo apt-get install build-essential
      
    3. Compile the Code: Use the terminal to navigate to the directory containing your C source files. You can compile your program using the GCC compiler with a command like:
         gcc -o my_program my_program.c
      
      Replace my_program.c with the name of your source file, and my_program with the desired output executable name.
    4. Run the Program: After compilation, you can run your program using:
         ./my_program
      
    5. Debugging: If you encounter errors during compilation, you may need to address them by modifying your code or including necessary libraries.

    This process involves ensuring that your code is compatible with Linux and using the appropriate tools available in the Linux environment.

    0 comments No comments

  2. Susmitha T (INFOSYS LIMITED) 1,875 Reputation points Microsoft External Staff
    2025-12-15T08:57:51.3133333+00:00

    Thank you reaching out!

     
    I see you're trying to compile a C program that was developed using Microsoft Visual C/C++ 6.0 on a Linux system. While that specific version of MSVC is mainly for Windows, you can still achieve this task by following a few steps with the right tools and compilers on your Linux setup.

     Here’s a general approach you can take:

     1. Install GCC: Most Linux distributions come with the GNU Compiler Collection (GCC) pre-installed, but if it's not installed, you can do so by running:
    sudo apt update
    sudo apt install build-essential

     2. Modify Source Code: Since MSVC and GCC might use different headers or syntax, you might need to make some adjustments to the source code. For example, certain MSVC-specific functions or libraries may not be available in GCC. You might need to replace these with their POSIX equivalents.

     3. Compile the Code: To compile, you can use the following command:  
     gcc -o output_program your_program.c   

    Here, output_program is the name of the compiled executable, and your_program.c is your source file.

     4. Run the Executable: After successful compilation, you can run your program
    using:  ./output_program

     5. Debug as Necessary: If you encounter errors while compiling, pay attention to the error messages, as they often indicate necessary changes to the code.

     

     

     References: https://xtls-v4.hkg1.meaqua.org/en-us/cpp/build/walkthrough-compile-a-c-program-on-the-command-line?vie…
    https://xtls-v4.hkg1.meaqua.org/en-us/cpp/build/projects-and-build-systems-cpp?view=msvc-170"
    https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022

     

     

    Let me know if you need any further help with this. I will be happy to assist.
    If you find this helpful, Kindly mark the provided solution as "Accept Answer", so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.