0
votes

I have been trying to port my C++ based mass data transport protocol project into visual studio 2010 with no success :(

The code I have been working on is fully compatible with Win based systems..well this is what my mentor also says :) But I have not been able to make the project build and run using my existing *.h & *.cpp files under VS 2010.

The Project basically is a API under which i have 4 separate applications. The hierarchy would be:

  1. SRC FOLDER- all the *.h and respective *.cpp files

  2. APP FOLDER- 4 applications (the API / library and some *.h files to be available before linking such as the final dll file under SRC folder & the main header file under APP folder)

I do also have a makefile as when the project was developed on Linux platform but I have no idea how to implement the same on Visual Studio 2010

FYI: VS 2010 on compiling reports that there are missing header files such as <cstdlib>, <unistd> but my best bet is this is not the real prob. but the prob. lies in the way I make the project build itself. I don't know should I go with making a dynamic dll project for the main library and then make the 4 empty c++ projects inside that for the 4 respective applications..?

Cheers, echo9

1
You'd should create 1 solution, and 5 projects within that solution , 1 project for the library and one for each application. Start with getting the library compiled. But what is the actual problem, the question seems quite general and broad ?nos
@nos thanks for replying so fast. The problem lies in the missing header files. I have already declared the required #ifndef WIN32 preprocs. but still don't know whats keeping VS 2010 to just throw up like 13 errors :(echo9
unistd is not available on Windows, but cstdlib definitely should be there - are you compiling the code as C or C++?user2100815
@unapersson I am compiling the code in Visual C++ available under VS 2010 Pro. The code is actually a bit of mix (C and C++; major being C++) I have chosen an empty c++ project while creating a new project to get a compiler version of the lib first.. and still stuck on it :( And for unistd I have already defined something as: #ifndef WIN32 #include <unistd.h> #else #include <winsock2.h> #include <ws2tcpip.h> #endifecho9
guys I was able to resolve the previous errors but now I am facing a new one: "definition of dllimport static data member not allowed" What does that mean?echo9

1 Answers

2
votes

I would recommend that you parse the data that you need from the working .mak file that you used previously. Create an empty project & sln, then add the contents of the "src" by using "add->existing files" in the file menu.

At that point open up the project configuration settings and go through the C++ and linker settings one by one. At each step have a look at the linux .mak file and see that you are choosing equivalent options and path settings. In particular make sure that you add all of the necessary include paths to where your .h files are.

That's what I would do anyways... same process as porting forwards old MSVC4 .mak projects to a modern version.