Create a C++ console application in Visual Studio

This topic describes the steps needed to configure a C++ console application in Visual Studio.

Create the Visual Studio project

  1. Create a Visual C++, Win32 Console Application in Visual Studio 2015. Name the project ‘SimpleDVD’.
  2. Download the 64 bit version of DVDBuilder for C++ (Windows). The file you need will have a name similar to – the version number may differ.
  3. Unzip in a location of your choice, then copy the include and lib directories to the project directory.
  4. Add DVDBuilder.h, AVBlocks.h, PrimoBurner.h, and DVDBuilder64.lib, AVBlocks64.lib, PrimoBurner64.lib to stdafx.h:

// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently

#pragma once

#include "targetver.h"

#include <stdio.h>
#include <tchar.h>

// TODO: reference additional headers your program requires here
#include <iostream>
#include <thread>
#include <chrono>
#include <experimental\filesystem>

// the main DVDBuilder header
#include "include\DVDBuilder.h"

// optional AVBlocks and PrimoBurner headers
#include "include\AVBlocks.h"
#include "include\PrimoBurner.h"

// needed for C++11 features
#include "include\PrimoReference++.h"

// link with DVDBuilder64.lib
#pragma comment(lib, "lib\\DVDBuilder64.lib")

// link with optional libs
#pragma comment(lib, "lib\\AVBlocks64.lib")
#pragma comment(lib, "lib\\PrimoBurner64.lib")
  1. In Visual Studio, select ‘Build | Configuration Manager’ from the menu, then add the ‘x64′ platform to the solution platforms.
  2. Build the project.
  3. Copy the files DVDBuilder64.dll, AVBlocks64.dll, PrimoBurner64.dll from lib to x64\Debug.
  4. Replace the contents of ‘SimpleDVD.cpp’ with this code:

// SimpleDVD.cpp : Defines the entry point for the console application.

#include "stdafx.h"

// for less typing
using namespace std;

// alias experimental::filesystem
// or you can use boost::filesystem,
namespace fs = experimental::filesystem;

// alias primo
namespace p = primo;

const wstring DVDProjectDirectory = L"C:/ElephantDVD";

void convert_source_to_mpeg2(wstring inputFile, wstring outputFile);
void build_dvd_structures(wstring project, wstring dvdFiles);

int main()
    // Video encoding

    // DVD authoring

    // DVD burning

    // Step 1: Convert sources
    wstring source_mp4 = fs::path(DVDProjectDirectory).append(L"Elephant_512kb.mp4");
    wstring source_mpeg2 = fs::path(DVDProjectDirectory).append(L"Elephant.mpg");

    convert_source_to_mpeg2(source_mp4, source_mpeg2);

    // Step 2: Build DVD structures
    wstring project = fs::path(DVDProjectDirectory).append(L"project.xml");
    wstring dvdFiles = fs::path(DVDProjectDirectory).append(L"dvd");

    build_dvd_structures(project, dvdFiles);


    return 0;

// Convert sources
void convert_source_to_mpeg2(wstring inputFile, wstring outputFile)
    using namespace primo::avblocks;
    using namespace primo::avblocks::Library;

    if (fs::exists(outputFile))

    auto inputInfo = p::make_ref(


    if (inputInfo->load()) {
        auto inputSocket = p::make_ref(

        auto outputSocket = p::make_ref(


        auto transcoder = p::make_ref(



        if (transcoder->open()) {

// Build DVD structures
void build_dvd_structures(wstring project, wstring dvdFiles)
    using namespace primo::dvdbuilder;
    using namespace primo::dvdbuilder::Library;

    if (fs::exists(dvdFiles))

    auto dvdBuilder = p::make_ref(



Run the application

  1. Create C:\ElephantDVD directory. We will refer to that as the DVD Project Directory.
  2. Download the clip Elephant_512kb.mp4 from the Internet Archive to the DVD Project Directory.
  3. Download the file project.xml from DVDBuilder-Samples Repo to the DVD Project Directory.
  4. Run the application in Visual Studio. Wait a few seconds for the video conversion and DVD building to finish. The DVD structure will be generated in the dvd sub-directory of the DVD Project Directory.


  • You may get 'The program can't start because DVDBuilder64.dll is missing from your computer. Try reinstalling the program to fix this problem.' or a similar message. To fix this, copy the file DVDBuilder64.dll from lib to x64\Debug.

Last updated on March 1st, 2016 12:00:00 AM