-1

I have started a new solution under VS that has both a managed, UWP code project and a native project. The compiler compiles the native code and delivers a .lib file just fine. When compiling the managed code, the compiler compiles the native code again -- as managed code and spits out errors.

I have another solution that use to work and I have tried to replicate the settings. After a day of comparing the property settings, I cannot figure out why it's doing what it's doing.

Ideas for where to look?

_____ New below_____

I have started a new solution an project and replicated everything. Here's what I've learned.

First, the compile order is different -- there was a missing stdafx.h file and the errors went from infinite to just 25. They are now related to one file, MotionBase. The native project compiles just fine, then the managed project compiles and it barfs on MotionBase. This code sample gives errors "'MotionBase': is not a member of 'BallLib'" and"'input': unknown override specifier".

#pragma once
#include "stdafx.h"
#include "FiniteDiffHelpers.h"
#include "MotionBase.h"
#include "MultiVarSolver.h"

namespace BallLib {
    class PathFinderHelper : public FiniteDiffHelper
    {
    public:
        PathFinderHelper();
        Line locs;
        BallLib::MotionBase output;
        MotionBase input;

.....

PathFinderHelper compiled fine in the native project. There are no errors in MotionBase. MotionBase is part of BallLib. Intelisense gives no errors in PathFinderHelper.

doby
  • 545
  • 4
  • 9
  • 1
    This question should have been closed in the first five minutes of its existence. – n. m. could be an AI Dec 24 '18 at 16:36
  • Make sure that "Use Library Dependency Inputs" on the project reference is false. – Ben Voigt Dec 24 '18 at 16:44
  • @n.m.: When you say "question should be closed" you need to give a reason. It clearly is not off-topic, because it is a question about tools used by programmers and is unique to software development (someone using Visual C++ as a glorified text editor would never encounter this). – Ben Voigt Dec 24 '18 at 16:45
  • @BenVoigt To my eye It contains no useful information to diagnose the problem. Well obviously you think it does. For what I know, "Use Library Dependency Inputs" is a linker option, not a compiler option. It tells the linker to use object (not source) files rather than the library file. I'm known to be wrong fairly often though. – n. m. could be an AI Dec 24 '18 at 17:08
  • @n.m.: I'm skeptical on it being the solution here, because the compiler should respect the per-file compile options (including "no `/clr`")... but it's something that OP would have missed by just looking through project properties, so I wanted to mention it. I expanded my comment into an answer only because an image is very helpful in finding said setting. – Ben Voigt Dec 24 '18 at 17:11
  • @n.m.: Another possibility is "link time code generation", which delays compilation until the link stage (but it still should respect per-file compile options) – Ben Voigt Dec 24 '18 at 17:19
  • @n.m. Sorry, you are disappointed with the question. I work alone, with no support. This is a show stopper for me. It's been a week of trying anything and everything. – doby Dec 24 '18 at 20:05
  • I understand it is hard to share your entire project, but you could at least try to show *something* related to your project. A screenshot or two, even, if all else fails. You could also try to reproduce the situation from scratch with a freshly made project, carefully recording all your steps. If the ew project fails the same way, show the steps. If it doesn't, compare the property sheets and try changing options on the fresh project until they match the bad project. – n. m. could be an AI Dec 24 '18 at 20:19

2 Answers2

2

Ensure the stdafx.h files are properly inserted in the code. The build order is different so you may get trapped.

Include (#include) the native stdafx.h in the managed pch.h file.

doby
  • 545
  • 4
  • 9
0

Not all the relevant settings are in the project properties dialog. Also check the properties non-modal window, particularly with the project-to-project reference selected inside Solution Explorer.

There you will find a setting named "Use Library Dependency Inputs" which causes the main project to include the individual source files from the library project, instead of the static library. Make sure this is set to False.

enter image description here

Ben Voigt
  • 277,958
  • 43
  • 419
  • 720