简体   繁体   中英

include .obj file to project in Visual Studio by #pragma in C++

is there any way to import .obj file to project by #pragma? I know that is posible to include .lib file, but I don´t find way to include .obj file. Problem is, that I have Windows appliaction and for that application I have another test project. I add dependencies to test project. I also add include file to test project, so that I see files from Windows application. But when I want to use some class or method from Windows Application, the linker said that has "unresolved external symbol". Ok, I find .obj files from Windows application and add them to Additional dependencies. And now it´s work. But it´s uncomfortable to each new class, that I create, go to properties of test project and add that file. In additional, when I often delet old classes and add new.

So I hope, that there is another way to do it. Like with .lib files.

Or is there another better way to do it? Here is my project on GitHub . I am using Visual Studio 2013.

Thanks for help and sorry my English :)

So, I fannly solve it. I created small script, thats look into window application folder for all *.obj files, then it change the .vcxproj file, which is actualy .xml file with config. Then I connect this script with post build event ( Project Properties -> Configuration Properties -> Build Events -> Post-Build event ) of windows application.

In every build, VS says that something was changed, and if you want to reaload it. Click to reaload and this is all.

Its work fine for me, at least for now.

https://github.com/Kowalsky95/VisualStudioObjDependencyAdding

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM