how to solve pgcc&openacc linker error "__pgi_uacc_multicorestart", "__pgi_uacc_multicoreend"
This is a follow up question after the one above.
In "compile lbe.c to lbe.o message:", I always see the "PGC-I-0222-Redundant definition" message. Is it a warning or error? Why would it happen? How do I fix it?
PGC-I-0222-Redundant definition for symbol __THROW (/usr/include/x86_64-linux-gnu/sys/cdefs.h: 74)
PGC-I-0222-Redundant definition for symbol __extension__ (/usr/include/x86_64-linux-gnu/sys/cdefs.h: 358)
There are just information messages indicating that the symbols are getting defined twice. Since it's the same definition for both, it's fine and no need to fix.
Related
Curiously, the last time I worked with this project in 2018, everything was fine. I have no idea what changed. My project is a DLL written in C++. Today when I built it I got messages:
uafxcw.lib(dllmodul.obj) : error LNK2005: _DllMain#12 already defined in LIBCMT.lib(dllmain.obj)
uafxcw.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2#YAPAXI#Z) already defined in LIBCMT.lib(new.obj)
uafxcw.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3#YAXPAX#Z) already defined in LIBCMT.lib(delete.obj)
uafxcw.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new[](unsigned int)" (??_U#YAPAXI#Z) already defined in LIBCMT.lib(new2.obj)
I tried setting /NODEFAULTLIB:LIBCMT.lib and then I got a huge number of unresolved references. So I put LIBCMT.lib back in and used /NODEFAULTLIB:uafxcw.lib, and to the surprise of nobody, got a huge number of unresolved references.None of the conflicts are symbols I've defined myself; they are all library entries. Is there a standard way to resolve these conflicts?Edit 1: Since originally posting, I have also tried adding the linker option /FORCE:MULTIPLE. This seems to work but feels uncomfortable because I don't know if the various definitions lead to the same code and anyway this situation is kind of ugly; I feel that there has to be a better way.
I am not a C guru. I am trying to compile someone else's C code, and am getting the following error:
Undefined symbols for architecture x86_64:
"_stdscr", referenced from:
_new_line in libsms.a(cstatus.o)
_message in libsms.a(cstatus.o)
the "stdscr" method comes from, I think, both "ncurses.h" and "curses.h". The code seems to be expecting "ncurses.h".
The "ncurses.h" file appears to define "stdscr" (no underscore in the name) whereas the linker is complaining about the symbol "_stdscr" (note the underscore).
I have -lncurses in my compiler flags, and I think that bit is working.
If I change the C source code to refer to the variable as "_stdscr", I get
error: ‘_stdscr’ undeclared
instead.
Can someone please
explain where this underscore is coming from and what it's doing?
help me how to know for sure that the ncurses.h header is being correctly found and referenced?
point me in the right direction for further investigation?
This question is raised due to a situation that I encountered
Say I have these external files and some declarations or definitions in them:
foo1.h
extern void ext_func();
foo1.c
void ext_func(){
....
}
foo2.c
#include "foo1.h"
int Modelica_func(){
ext_func();
}
I defined ext_func() in foo1.c. Then, in foo1.h I declared it to be extern, because I want to use it in foo2.c. Modelica_func() is the function that I will be using in Modelica.
The compiler always throws out error LNK2019 to me complaining unresolved external symbol, I guess it's probably due to the reason that the header file cannot find it's matching c file. I am working in Dymola, and I've put all of these files in WorkingFolder/Sources/Include. But still I got the same error. I want others to see my code, so I cannot use static or dynamic library.
Greatly appreciated if anyone could help me a bit of this. THANKS!
You can find some details in Section 12.9.4 of the Modelica Specification.
I build one DLL on windows with microsoft-visual-c 6.0 including the source code from libxml2. Now I have used some xmlFree() calls in my code and I now get the linker warning LNK4049.
I have not the slightest idea, how to get rid of this warning. I googled, but all info I found was above my comprehension (I use normally gcc under solaris). Is there a simple receipt (add/remove compiler-flag or #define/#undef or similar)?
Thanks,
Peter
I was getting this warning when statically linking against libxml2_a.lib with MSVC 11. I haven't tried the DLL version so I'm not sure if it is affected in the same way.
The solution was to define these symbols in your project or makefile to tell the libxml2 header files to assume static linkage and avoid dll-importing and dll-exporting the xmlFree variable at the same time:
LIBXML_STATIC
The same applies to libxslt/libexslt too:
LIBXSLT_STATIC
LIBEXSLT_STATIC
Hope this helps.
I will add bit more context for others who face similar error like following.
We did libxml upgrade from 2.9.4 to 2.9.14 and we observed following errors which are similar to above .
warning LNK4217: locally defined symbol xmlStrcmp imported in function
"void __cdecl ::updateRunElement(struct _xmlNode *,class xml::XmlDoc &,struct _xmlNode *,struct const &)"
(?updateRunElement#YAXPEAU_xmlNode##AEAVXmlDoc#xml#2##2##Z)
LINK : error LNK1218: warning treated as error; no output file generated
warning LNK4217: locally defined symbol xmlFreeDoc imported in function "public: __cdecl xml::XmlDoc::~XmlDoc(void)" (??1XmlDoc#xml##QEAA#XZ)
LINK : error LNK1218: warning treated as error; no output file generated
All the other answers for this error points to set runtime library to /md (Multithreaded dll) or viceversa.
I also tried to suppress these warning by
#pragma warning( disable : 4217 1218) and also by project setting "Disable Specific Warnings" but both did not work as keep giving warnings/errors.
But as #vladimir. (Thanks for the answer) suggested defining LIBXML_STATIC as preprocessor in the project where you are using libxml library either as static or dynamically linked should fix all these warning errors.
I get this problem while compiling my code.
Error 14 error LNK2019: unresolved external symbol _findFuncs referenced in function _main H:\pshtoolkit_v1.4-src\whosthere\whosthere.obj whoisthere-alt
What libraries should I link with visual studio in order to resolve the error?
What libraries should I link with visual studio:
The library containing _findFuncs.
OK, not helpful I know, but presumably you know what findFuncs is and you are calling it for a reason. Where did you find out about it? Do you have any documentation?
Maybe you have a typo calling this function (case?), e.g. should it be FindFuncs?
Or is it defined somewhere as a static function?
I have solved the error, it is not the problems with the libraries. The .c file which contains the fincFuncs method had not been properly referenced. Thanks for helping though!
It's actually Linker error which your compiler doesn't resolve that name I think just
do forward declartion for the symbol which you are using in main.
May be you have done forward declaration but missing the definition itself.
Which your linker is looking for
Here it's your function "findfunc"
Check whether it works or not