2

Background

I'm running Visual Studio Community 2015 on Windows 10, writing C++ code.

I have been handed a solution with two projects in it. I need to create a duplicate of one of the projects, but using different source and header files (containing roughly identical code, but located in another place in the file system).

The project that I want to duplicate uses a lot of libraries, and I don't know how that was set up. All I know is that it works for that project, and I need it to work for the duplicate project too.

Problem

The problem I'm having is that at least one of the libraries does not seem to be recognized. This results in code with a red squiggly line under it, no auto-complete, etc. etc.. (This is not relevant anymore, see Edit 1)

Attempted solutions

I have tried creating a new project with the new source files, adding it to the solution, and manually copying project settings by right-clicking on the existing project, selecting Properties, and copying anything that is not set to its default value. This did not work.

I have tried copying the existing .vcxproj files, adding them to the solution, removing old and re-adding new source and header files. This did not work.

In both cases, when expanding External Dependencies in the Solution Explorer, the old project has a much longer list than the duplicate.

I am aware of this question, but the accepted answer relies on knowing which settings need to be changed. I don't know that, and I don't know how to find out.

Questions

So, is there a way to copy the entire set of settings that controls this?

Alternatively, is there a way I can check in the existing project precisely why it is able to resolve a particular external reference, so that I can find out which setting I need to change in the duplicate?


Edit 1 Well, now I feel stupid. I've been fighting this issue for a few days now, but I've made a few incorrect assumptions about the files I have.

It turns out, the second set of header files (located at a new place in the file system) are similar, but not identical, to the old ones. So at first glance, they look identical, and I never bothered to check.

The new header files has #if defined(WIN64) before the relevant #include statements, which of course is why the library wasn't being included.

So, my new question is, what's a sensible way to #define WIN64 without modifying the header file? Where can I put that definition so that it's valid in that header file, without changing that header file?

gibson
  • 543
  • 1
  • 5
  • 15

1 Answers1

3

The correct way to use the same project properties for multiple projects would be not copy-pasting properties between them but to use Property Manager. You should figure out how exactly you original project is configured (note that properties for particular file can differ from project properties) and create a corresponding property sheet(s). Then apply this sheet for the new project.

user7860670
  • 35,849
  • 4
  • 58
  • 84
  • And the question then is how I figure out how the original project is configured? – gibson Nov 02 '17 at 14:55
  • @gibson You should be able to do this by browsing original project property pages. If that one particular library does not get recognized then you should lookup how it is referenced in the original project. Check property pages for project itself and for files hat use that library (and receive a squiggly line). – user7860670 Nov 02 '17 at 14:59
  • 1
    As I stated in the original question, I have done that to the best of my ability. – gibson Nov 02 '17 at 15:01
  • @gibson Most likely you've missed something basic. Actually which library is it? Does it have any documentation on how it is supposed to be used? – user7860670 Nov 02 '17 at 15:02
  • The library is called Eigen. And having dug deeper in a slightly different direction than the past two days' digging, I have indeed missed something basic. I'll edit the question to include my new findings, and ask a follow up question. – gibson Nov 02 '17 at 15:09
  • So, the question is updated to reflect my new findings. Oh how I wish I'd thought of actually checking those basic things before digging around in the dense forest of settings... – gibson Nov 02 '17 at 15:18
  • This answer assumes the old project needs to remain and therefore copy-pasting is therefore a violation of clean design ... but that is not my case, and I simply need to copy these settings from one project to another. The project I'm copying from is irrelevant. Sadly, just copy/pasting doesn't work. – PandaWood Aug 16 '21 at 03:22