linkage

java.lang.LinkageError: loader constraint violation previously initiated loading for a different type with name “javax/xml/soap/SOAPMessage”

落爺英雄遲暮 提交于 2019-12-14 03:47:15
问题 I'm new to webservices. I'm trying to call a service but I'm having the below error. Based on my initial google search seems this is a loader issue that can be caused by duplicate jars, but I cannot locate which one causes this. Any help is very much appreciated. Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) previously initiated loading for a different type with name "javax/xml/soap/SOAPMessage" at org

Assigning {pointer to function with C linkage} to {pointer to function with C++ linkage} and vice versa

二次信任 提交于 2019-12-13 16:24:41
问题 Is this code legal? extern "C" typedef void (ft_blah_c)(); /*extern "C++"*/ typedef void (ft_blah_cpp)(); extern "C" void fn_blah_c() {} /*extern "C++"*/ void fn_blah_cpp() {} ft_blah_c *g_Blah_c = fn_blah_cpp; // <--- ? ft_blah_cpp *g_Blah_cpp = fn_blah_c; // <--- ? I have real code with similiar assigments, it compiles and executes without any problems (MSVC 2010). 回答1: In general that should not work. The problem is that when you call fn_blah_c or fn_blah_cpp directly the compiler knows

How to solve C++ conflicts between system and library dependencies

若如初见. 提交于 2019-12-13 15:03:45
问题 My problem is rather specific, but bear with me. This in the end is kinda reverse engineering, but this problem in particular seems to fit more this board. So, I have a shared object compiled for MIPS written in C++. I don't have the source code of the lib. The lib is compiled using GCC 4.3.3. I want to use functions present in this shared object in my amd64 computer running elementary OS. To do this, I used the sourcery cross compiler to cross compile some C++ code to MIPS, that would use

error LNK2019: unresolved external symbol in a multiple projects solution

a 夏天 提交于 2019-12-13 01:03:44
问题 I have a visual studio solution with multiple projects. One of them, "MyProject" is a static library (.lib). The project, among many other classes has two classes "A" and "B". A.h: #pragma once class A { public: void foo(); }; A.cpp: #include A.h void A::foo(){ //do something } B.h: #pragma once class B { public: void bar(); }; B.cpp: #include B.h #include A.h void B::bar(){ A a; a.foo(); } Without compilation errors I'm getting the linkage error: OtherProject.lib(B.obj) : error LNK2019:

Warning (Anachronism): Assigning void(*)(int) to extern “C” void(*)(int)

时光毁灭记忆、已成空白 提交于 2019-12-12 18:08:32
问题 I'm having trouble with Sun's C++ compiler. I've read Oracle's Working with Pointers to Functions [from C++]. Its a good read, and I get the impression SunCC is most compliant among all the compilers in this area (though its causing me trouble). The test code is below, and line 24 is new_handler.sa_handler = (pfn ? pfn : &SignalHandler::NullHandler); . Unrolling the ternary operator shows this is the issue: new_handler.sa_handler = pfn; . SunCC 5.11 $ /opt/solstudio12.2/bin/CC test.cxx "test

matlab mex files and C++ dll (windows)

假如想象 提交于 2019-12-12 14:42:14
问题 I have a DLL with class Test. Header: class MY_EXPORT Test { public: int doit(const string &str); }; and source: int Test::doit(const string &str) { return int(str.length()); } Now I use it from mex file: void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { string str("hello!"); Test *t = new Test(); t ->doit(str); } The problem, that variable str is not passed correctly to the method doit . Inside the method it contains rabish. I found that this happens with any

C++ standard: ODR and constexpr std::string_view

时光怂恿深爱的人放手 提交于 2019-12-12 09:55:16
问题 If I have a header foo.h which contains #ifndef FOO_H_ #define FOO_H_ namespace foo { constexpr std::string_view kSomeString = "blah"; } #endif // FOO_H_ then is it safe to include foo.h from within multiple .cc files in a single program, regardless of what they do with the symbol kSomeString , or are there some uses that could cause an ODR violation? Also, is it guaranteed that kSomeString.data() will return the same pointer across .cc files? I'd like specific references to wording in the C+

No linkage at block scope?

爷,独闯天下 提交于 2019-12-12 08:26:44
问题 Do all variables declared in a block have 'no linkage'? For example: 1: If I declare a static variable: void foo() { static int i; } Would it have an internal linkage or no linkage? If no linkage, then why make it static? 2: What happens if I use extern? /*global scope*/ static int i; void foo() { extern int i; } In this case, what will be the linkage of i ? 回答1: Indeed, 'no linkage' at function scope. The goal is lifetime management: the static has the lifetime of a global static, while it

What does external linkage mean [duplicate]

吃可爱长大的小学妹 提交于 2019-12-12 01:25:49
问题 This question already has answers here : What is an undefined reference/unresolved external symbol error and how do I fix it? (32 answers) Closed 5 years ago . Consider the following code: #include <stdio.h> namespace EnclosingNmspc { namespace Nmspc { extern int a;//This a and the a defined above denote the same entity int a=5; } } extern int a; int main() { printf("%d\n",a); } There is the quote from 3.5/2: When a name has external linkage , the entity it denotes can be referred to by names

Linkage error with glui32.lib and libcd.lib on Visual Studio

我的梦境 提交于 2019-12-11 12:14:09
问题 I am trying to port a (very) old project of mine from Visual Studio 6 to Visual Studio 2010. The project is an OpenGL application, and as such, it uses the following libraries (amongst others): glu32.lib glui32.lib glut32.lib opengl32.lib The glui32.lib library links the libcd.lib library, which is not supported on Visual Studio 2010. So I need to find a version of the glui32.lib library, which links the libcmtd.lib library instead. My questions are: Is there any such version of the glui32