Nana uses the basic_types.hpp for nana::rectangle and others. Trying to compile this into a libnana.a I find leaves the source code in the .hpp file out. The hpp file is - I suspect - not getting compiled into any .o object file.
Afterwards I get a linker error (ld) saying it cannot find these references in particular. I'm stumped; using Netbeans 8.2 I get nowhere with this.
I think the issue is that the static library will not have compiled in the basic_types.hpp file and so the linker will always complain about missing values.
I've asked on the Nana forums and they've suggested that it's probably a Netbean or g++ configuration issue.
Can you guys see about helping me on this one? It's run on Windows 10 and MinGW for compatibility and it's simply tuff.
An extention of .hpp file usually indicates a header file. It's supposed to be #included in any translation unit that needs to use the things that are defined in it, rather than compiled into its own translation unit and linked against.
I think I agree. It would be very unusual to find this out of order in a library. What could I understand here? I really need this gone, closed. - off my desk.
What are the actual errors you're getting? The linker doesn't even know about .hpp files, so the presence or absence of one should make literally no difference, as far as the linker is concerned.
Also, rather finally, we do see the basic_types.hpp is included in the cpp files where appropriate. This would seem to indicate that the .o and resulting .a files have the appropriate header file(s) reference(s).
...
Library Files/libnana.a(native_paint_interface.o):native_paint_interface.cpp:(.text+0x19): undefined reference to `__imp_GetObjectW'
Library Files/libnana.a(native_paint_interface.o):native_paint_interface.cpp:(.text+0x2c): undefined reference to `nana::size::size(unsigned int, unsigned int)'
Library Files/libnana.a(native_paint_interface.o):native_paint_interface.cpp:(.text+0x46): undefined reference to `nana::size::size()'
...
On digging we find the native_paint_interface.cpp does have via its direct hpp include a reference to basic_types.hpp. This would seem to conclude the issue as correctly drawn from the standpoint of the g++ compiler. However we are left with something here which trips the linker or something left in the compiler.
2. We must be able to ask the linker (ld in this case) to include the hpp files as part of the linking process.
Like I said, the linker doesn't know or care about .hpp files. It doesn't even care about .cpp files. All it can see is .o/.obj and .a/.lib.
It sounds like the problem is that you're not linking your program to the nana import/static library. How did you obtain the library? Did you download sources, binaries, or did you install it via a package manager?
We compiled the libnana.a via Netbeans 8.2. It does have references for the static library build to all the headers. However when we try to use the static library (libnana.a) the g++ command fails to find appropriate connection in the final g++ compilation.
I am unsure on it; g++ is supposedly for linux and the MinGW and all this is easily confused with c:/dir/subdir. Let me know what else I could try.
Thanks. Consider this closed if nothing else occurs to you.