By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,161 Members | 2,002 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,161 IT Pros & Developers. It's quick & easy.

Converting unix project over to windows Visual Studio

RRick
Expert 100+
P: 463
I have a unix C++ project that needs to be converted over to windows visual studio. I'm not sure of the exact version of VS, but it's a recent version, probabIy 2003 or 2005.

I would like the windows directory tree to mimic the unix tree as closely as possible, but I don't want duplicate files and other inconsistencies. I have come up with an idea but I don't know how close it fits a "typical" windows project. If you know of specific links that deals with this subject, please post them.

The unix project creates a single library from the app directory tree and the test directory tree is the corresponding set of unit tests for the app tree. The structure of the unix project is:
  • unix_project
    • include
    • lib
    • app
      • util
        • math
        • string
    • test
      • util
        • math
        • string
This deviates a little bit from the unix standard where the app directory replaces the src directory and test replaces example.

Unix Include Directory
The main problem I'm having with the directory structure is converting the unix include directory over to a windows directory. Windows has a "common" directory concept. In this case, can I rename the include directory to common? Is this the usual use of common and header files? I thought of getting rid of the include/common directory, but the include/common directory is needed when distributing the library.

Also, the files in the unix include directory are links to the header files under the app tree. The links allow the user to edit the header locally or in the include directory and end up modifying the same file. In windows, it looks like I'll have to move the headers files over to the common directory to avoid duplicate header files

Visual Studio Setup
Visual Studio has the concept of a solution and project and little else. After playing around with VS for a while I came up with the following structure.

The "solution" would the the unix/windows project and the "projects" will be app and the various executables under test. By using solution folders and project filters (?) I was able to mimic the unix tree very closely.

One odd artifact came from putting all the headers files in a solution folder called common. This appears to be purely cosmetic and allows users to see the header files.

I tried making multiple projects under app (i.e. app/util/math and app/util/string) that modified the same static library, but this didn't work. I couldn't get them to work together. Math would wipe out string changes and vice versa. This appears to be a limitation of the VS project.

I have a similar problem with the test tree. I have two different test executables under the test/utill/math tree(i.e. mathUtil and random). Does this mean I need two projects? VS keeps creating new directories for each project, that I really don't want. Is it possible to have multiple executables in the same project?

Also, if there is something I missed, let me know.
Aug 15 '08 #1
Share this Question
Share on Google+
1 Reply


100+
P: 424
I've recently started using visual studio myself and encountered some similar problems. This is what I found out:
The main problem I'm having with the directory structure is converting the unix include directory over to a windows directory.
You can set additional include directories for each project in the project properties (Alt-F7) under Configuration Properties->C/C++->General, this is equivalent to the -I (upper case i) option for g++, additional libraries (g++'s -l (lower case L) switch) are listed in Configuration Properties->Linker->Input "Additional Dependencies", and the path to those libraries (g++'s -L switch) is in Configuration Properties->Linker->General "Additional Library Directories". You can also add those directories to the global search path in Tools->Options->Projects&Solutions->VC++ Directories
I tried making multiple projects under app (i.e. app/util/math and app/util/string) that modified the same static library, but this didn't work. I couldn't get them to work together. Math would wipe out string changes and vice versa. This appears to be a limitation of the VS project.
If some projects share source files then they may interfere with each other as they build. There are three solutions to that as I see it; you can
- build one solution at a time: Tools->Options->Projects&Solutions->Build&Run, set "maximum parallel project builds" to 1 or
- change the project dependencies Project->Project dependencies such that the build order (same dialog box) is correct or
- use different directories for the intermediate files of each project (see below).
I have a similar problem with the test tree. I have two different test executables under the test/utill/math tree(i.e. mathUtil and random). Does this mean I need two projects? VS keeps creating new directories for each project, that I really don't want. Is it possible to have multiple executables in the same project?
A solution can be comprised of several projects where each project builds to a single executable or library. You can place the solution and all its projects in the same directory, just uncheck the option "Create Directory For Solution" when you create a new project. Any intermediate files are placed in a directory specifed under Configuration Properties->General in the project properties (Alt-F7) and the linker places the executable/library it generates in a folder specified under Configuration Properties->Linker->General "Output File".

I'm not sure is this fully addresses your problems, but I hope this helps.
Aug 16 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.