Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

[VS2013] Hierarcy projects in solution + project headers only + linker

$
0
0
Hello my friend %User%! Please help me!

In order to separate a sense components, I have allocated some headers in one projects without cpp-files.
In compile time will appear a warning like:
warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library

How is more correctly to write a stub to remove warning? (without linker /ignore:4221)


At the next case I have some projects which are connected at one solution with references.
And in compile time appears error like a:
error LNK2019: unresolved external symbol __imp__wglCreateContext@4 referenced in function _main
error LNK1120: 1 unresolved externals

It seems like a linker doesn't find some lib references from child projects.


Then I'm trying to use:
Link Library Dependencies<- http://msdn.microsoft.com/en-us/library/024awkd1.aspx
at each project properties in projects references.

It looks like everything was compiled... But again appears some warnings:
11>Windows.GDI.lib(GDI32.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in Unknown.OpenGL.lib(OPENGL32.dll); second definition ignored
11>Windows.GDI.lib(GDI32.dll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
11>Windows.Kernel.lib(GDI32.dll) : warning LNK4006: __IMPORT_DESCRIPTOR_GDI32 already defined in Windows.GDI.lib(GDI32.dll); second definition ignored
11>Windows.Kernel.lib(GDI32.dll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
11>Windows.Kernel.lib(GDI32.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in Unknown.OpenGL.lib(OPENGL32.dll); second definition ignored
11>Windows.Kernel.lib(GDI32.dll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
11>Windows.Kernel.lib(GDI32.dll) : warning LNK4006: GDI32_NULL_THUNK_DATA already defined in Windows.GDI.lib(GDI32.dll); second definition ignored
11>Windows.Kernel.lib(GDI32.dll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
11>Windows.Kernel.lib(GDI32.dll) : warning LNK4006: _AbortDoc@4 already defined in Windows.GDI.lib(GDI32.dll); second definition ignored
11>Windows.Kernel.lib(GDI32.dll) : warning LNK4006: __imp__AbortDoc@4 already defined in Windows.GDI.lib(GDI32.dll); second definition ignored
11>Windows.Kernel.lib(GDI32.dll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
11>Windows.Kernel.lib(GDI32.dll) : warning LNK4006: _AbortPath@4 already defined in Windows.GDI.lib(GDI32.dll); second definition ignored
11>Windows.Kernel.lib(GDI32.dll) : warning LNK4006: __imp__AbortPath@4 already defined in Windows.GDI.lib(GDI32.dll); second definition ignored
+ some warnings from empty cpp projects

Windows.Kernel and Windows.GDI - projects (static libraries) without cpp

How to fix this?


I think the problem is multiple cross-references in one static library (gdi.lib or opengl32.lib)

At the project properties I'm found an option:
Use Library Dependency Inputs<- http://msdn.microsoft.com/en-us/library/024awkd1.aspx

Let's try... All errors disappear but we have this first problem with the main project which can't find any references of lib's from child projects
error LNK2019: unresolved external symbol __imp__wglCreateContext@4 referenced in function _main
error LNK1120: 1 unresolved externals

I also tried to change Link Library Dependencies and Use Library Dependency Inputs at the Linker properties - nothing.

If you fprcing link the lib in the main project (OpenGL32.lib) or try to writw anpragma comment lib, it works. But it's not a solution, because the main project doesn't use OpenGL directly. It would be great if the main project could get all the stuff from child project and linked correctly.

What to do in this situation?

Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>