0

I have a C++ program that I usually compile with Code::Blocks, but now I must find a way to compile it with VS Code. I've been watching tutorials for hours, but I still can't make it happen in VS Code.

The program is really simple. Here's my project settings from Code::Blocks

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
    <FileVersion major="1" minor="6" />
    <Project>
        <Option title="game_test" />
        <Option makefile="makefile" />
        <Option pch_mode="2" />
        <Option compiler="gcc" />
        <Build>
            <Target title="default">
                <Option output="game_test" prefix_auto="1" extension_auto="1" />
                <Option type="1" />
                <Option compiler="gcc" />
            </Target>
        </Build>
        <Linker>
            <Add library="ws2_32" />
        </Linker>
        <Unit filename="admin.cpp" />
        <Unit filename="common.cpp" />
        <Unit filename="common.h" />
        <Unit filename="database.cpp" />
        <Unit filename="database_auto.cpp" />
        <Unit filename="database_common.cpp" />
        <Unit filename="database_common.h" />
        <Unit filename="database_mysql.cpp" />
        <Unit filename="main.cpp" />
        <Unit filename="main.h" />
        <Unit filename="memory.cpp" />
        <Unit filename="memory.h" />
        <Unit filename="protocal.cpp" />
        <Unit filename="server.cpp" />
        <Unit filename="sock.cpp" />
        <Unit filename="user.cpp" />
        <Extensions>
            <code_completion />
            <envvars />
            <debugger />
        </Extensions>
    </Project>
</CodeBlocks_project_file>

Hope the settings from C::B will make it clear on what should be done.

  • 1
    The process [is not straightforward](http://forums.codeblocks.org/index.php?topic=11995.0)., and I don't know of any tools to automate it. I would recommend starting a new VS project, adding files from your CB project to it and transferring all library dependencies, compiler settings and linker settings over. – Pyromonk Jan 05 '18 at 05:23
  • The only thing I don't know how to setup is the linker. Can you help me do this ? – Steve Jobless Jan 05 '18 at 06:14
  • Sorry about the late response. Have you tried following [Microsoft's suggestions](https://msdn.microsoft.com/en-us/library/aa295848(v=vs.60).aspx) with regard to the linker? What external libraries are you using? – Pyromonk Jan 05 '18 at 06:52
  • just ws2_32. I have read the tutorial. For some reason i cant do it. Also that's for Visual Studio 6.0 and I am using Visual Studio Code. – Steve Jobless Jan 07 '18 at 03:26
  • VS Code, as far as I know, doesn't even have a compiler for its C++ component by default. I don't really know why one would move from CB to VS Code and not Notepad++, but that's for you to decide. Not a lot of information is available, but it seems like things are configured through so-called "tasks". Those links might help: [#0](https://code.visualstudio.com/docs/languages/cpp), [#1](https://stackoverflow.com/questions/30269449/how-do-i-set-up-visual-studio-code-to-compile-c-code), [#2](https://stackoverflow.com/questions/38404670/how-do-i-link-the-sfml-libraries-in-visual-studio-code). – Pyromonk Jan 07 '18 at 12:21

1 Answers1

0

Visual studio code is not an IDE it is a text editor.

You should start by adding the Microsoft Extension for C/C++. I suggest you check this tutorial out:

https://www.youtube.com/watch?v=X7CXjKGi_ro&t=2253s

it is almost an hour long, but it really gets you into setting up an environment for c++ development in VS code.

grybouilli
  • 185
  • 2
  • 11