0

I am new to visual studio and c++ . I have downloaded MessagePack for c/cpp and opened the file "msgpack_vc8.vcproj" it opened a visual studio project with a bunch of c files and hpp file.

now , I would like to see an example of how Message Pack serializes and deserializes data.

so I created a new cpp file called main and copied the example provided here:

Github messagepack

I built the solution and when I try to run it pops up this window :

enter image description here

and I have no idea how to run the file , what should I do there?

Community
  • 1
  • 1
yanish
  • 257
  • 2
  • 15

1 Answers1

2

I assume msgpack.vcproj is a LIBRARY project. You need an APPLICATION project to run and debug it.

If you are using a third-party library usually you would create a new Visual Studio application project, which contains at least a main.cpp with a main function. Then you would include and link the msgpack library to your project. That's what your link suggested:

Include msgpack.hpp header and link msgpack library to use MessagePack on your program.

Unless you plan to develop msgpack itself, you probably won't need msgpack.vcproj directly

Simon
  • 1,616
  • 2
  • 17
  • 39
  • Don't I need to include ALL the source files in order to use messagePack? – yanish Jul 09 '15 at 05:04
  • If you just use it as a lib, you only need to include the specified header and link to the library – Simon Jul 09 '15 at 06:13
  • how do I link the library ? is it in the properties ->C/C++->General>Additional Include Directories ? because when I try to build it says : "fatal error C1083: cannot open include file 'msgpack.hpp': no such file or directory" . and I added this file to the Header Files directory . – yanish Jul 09 '15 at 06:18
  • 1
    For include you need to add the directory, where msgpack.hpp is located to "C/C++->General>Additional Include Directories". In the main.cpp you would just write #include "msgpack.hpp". – Simon Jul 09 '15 at 06:21
  • 1
    For linking you need to add the directory of the .lib file to the Linker properties as well as the actual lib name – Simon Jul 09 '15 at 06:22