Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.1k views
in Technique[技术] by (71.8m points)

c++ - Visual Studio test project not finding main project

I created an empty C++ project in Visual Studio and added some code. Then following Microsoft's instructions I created a new Google Test project, selected "Add to solution" with my first project, and then in the next screen I selected the first project as the project under test.

I can get the main project to run, and I can get a test to run if it doesn't use my code. But I can't use my code in the tests.

Here is the current code that's trying to make its way to the test. You can also see in the explorer that the main project is indeed referenced in the test project.

But that is basically all I've done. I haven't played with any other settings anywhere at all. So don't assume I did something, or know something. Pretty n00by in these situations.

Thanks. enter image description here

The error: enter image description here

With regards to this being marked as a duplicate: while the question you've linked to does appear to make it clear that I have some sort of linker problem, there is so much information there -- over a dozen common causes -- that it doesn't actually help me answer my question, or at least not much more than telling me to, say, "read these 10 chapters of this C++ textbook". I would appreciate a response that points as close to "exactly" what I'm doing wrong as reasonably possible.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...