Linker error


#1

I have added winsock2.h and ws2tcpip.h to my maincomponent.cpp and I am writing some winsock code.

When I tried to compile and link in VS Express 2005 I get the following link error:

error LNK2001: unresolved external symbol “public: virtual void __thiscall juce::JUCEApplication::unhandledException(class exception const *,class juce::String const &,int)” (?unhandledException@JUCEApplication@juce@@UAEXPBVexception@@ABVString@2@H@Z)

Any Ideas?


#2

I removed all the winsock code and header files and I still get the error.

Before I add the winsock stuff, this project did compile no problem.


#3

Do a clean rebuild? That error doesn’t look familiar…


#4

I had found the error, somewhere along the way I mucked about with the order of the include libs, I fixed the order and it all compiled okay.

The only problem I have now is that the socket listner is on a linux firewall, and is written in perl. When I send the message it does not seem to respond or accept the message immediately and sometimes only when I close the socket, and then it only accepts the first message.

I have a perl windows client and that all works okay, I guess there is some difference between the windows c sockets and the perl socket implementation.

No sure there is anything I can do about it. might have to give up writing the windows perl client in JUCE/C++.


#5

The perl client will be using c sockets under the hood, so both should be able to work. Must just be some subtlety about the way they’re getting opened. Something to do with proxies?? I’m not too much of a networking expert!


#6

[quote=“aciddragon”]
When I tried to compile and link in VS Express 2005 I get the following link error:

error LNK2001: unresolved external symbol “public: virtual void __thiscall juce::JUCEApplication::unhandledException(class exception const *,class juce::String const &,int)” (?unhandledException@JUCEApplication@juce@@UAEXPBVexception@@ABVString@2@H@Z)

Any Ideas?[/quote]

i just wanted to build the demo application (/extras/juce demo) and got the same linker error. i did nothing else but adding the include- and library-paths to my project settings as instructed in the JUCE readme.html, before starting the build-process. this happens also for the hello-world application (extras/example projects). what’s wrong?


#7

No idea, except that like aciddragon said, you might have some lib or include paths mixed up.

The unhandledException method is right there in juce_Application.cpp, so unless that file’s missing, I can’t think of any reason why it’d fail to link it.


#8

Chack the order of your include dirs, it is important, get it wrong and you get the linker errors. I think in the doc it does specify what the order should be.


#9

mmmhh…strange. i have the order exactly as in the readme file. i managed to get it built by overriding the unhandledException()-function inside the JUCEHelloWorldApplication class (with an empty function). should i suspect any dangerous effects from that? however, even if not - that’s for sure only a workaround, no real solution.


#10

Well that’s baffling. It’s such a simple method, and is only called from within that one file, I just can’t think why it’d do that, or why overriding it would make any difference (except if the compiler was making a mistake or something)


#11

woah! i went on programming my application with my workaround - and i just tried to see what happens, if comment my overriden empty function out again - and…the linker error has automagically disappeared. trying to reconstruct, what i have changed… i added a lot of source files, but i think that’s irrelevant. but i also changed some optimization and debug-info settings in the compiler and linker - might this be worth to investigate further?


#12

mmmhhh. just changed back the settings. the error did not re-appear. very baffling indeed.


#13

TBH it just sounds like the compiler messed up. Maybe a proper clean rebuild would have sorted it out.


#14

yah. hopefully you’re right.


#15