Errors on Windows Builds

I am getting some odd errors on a app I have for windows and mac. On the mac I use the macoslib stuff for the app. In windows with the executable I get some errors pertaining to some cocoa framework stuff that cannot be found. I am unsure if it is because the build is done with macoslib or not.

How do I tell if they are framework errors or something different?

Thanks.

Are you using conditional compilation statements? Like this:

#if TargetCocoa // Cocoa only code here #end
… or this:

#if TargetCocoa // Cocoa only code here #elseif TargetWin32 // Windows only code here #else // code for all other targets here #end

Correct I am.

These are some of the errors I am seeing…


Runtime Error

Runtime Error
Press OK to Continue
Press Cancel to Quit.

Please report what caused this error
along with the information below.

Common\Loaders\Loader.cpp: 171
Failure Condition: 0
Failed to load library Cocoa.framework
The specified module could not be found.


OK Cancel


Runtime Error

Runtime Error
Press OK to Continue
Press Cancel to Quit.

Please report what caused this error
along with the information below.

Common\Loaders\Loader.cpp: 171
Failure Condition: 0
Failed to load library /usr/lib/libobjc.dylib
The specified module could not be found.
bs

OK Cancel


Runtime Error

Runtime Error
Press OK to Continue
Press Cancel to Quit.

Please report what caused this error
along with the information below.

Common\Loaders\Loader.cpp: 171
Failure Condition: 0
Failed to load library /usr/lib/libSystem.dylib
The specified module could not be found.


OK Cancel


Runtime Error

Runtime Error
Press OK to Continue
Press Cancel to Quit.

Please report what caused this error
along with the information below.

Common\Loaders\Loader.cpp: 171
Failure Condition: 0
Failed to load library /usr/lib/libobjc.dylib
The specified module could not be found.


OK Cancel


Runtime Error

Runtime Error
Press OK to Continue
Press Cancel to Quit.

Please report what caused this error
along with the information below.

Common\Loaders\Loader.cpp: 171
Failure Condition: 0
Failed to load library Cocoa.framework
The specified module could not be found.


OK Cancel


Runtime Error

Runtime Error
Press OK to Continue
Press Cancel to Quit.

Please report what caused this error
along with the information below.

Common\Loaders\Loader.cpp: 171
Failure Condition: 0
Failed to load library /usr/lib/libobjc.dylib
The specified module could not be found.


OK Cancel


Runtime Error

Runtime Error
Press OK to Continue
Press Cancel to Quit.

Please report what caused this error
along with the information below.

Common\Loaders\Loader.cpp: 171
Failure Condition: 0
Failed to load library /usr/lib/libobjc.dylib
The specified module could not be found.


OK Cancel

Actually I used TargetMacOS

All the errors are failing to load dylibs. These are OSX, not windows.

This means that you are failing to mask out the OSX calls somewhere in your code.

You must ensure that you have

#if TargetCocoa (or TargetMacOS) then ... #endif
around any declares that use cocoa.

I do have those all over and it still compiles it into windows.

[quote=82332:@Tom Russell]Common\Loaders\Loader.cpp: 171
Failure Condition: 0
Failed to load library Cocoa.framework
The specified module could not be found.[/quote]
This says its not all completely or correctly wrapped in conditional targets so the Cocoa.Framework is trying to be loaded on Windows

I am using the macoslib folder and libs in my project and I went through and it appears that they all are wrapped. I even added

#If TargetCocoa or TargetMacOS

Shouldnt that work?

It should but “something” - for various values of “something” - is trying to load Cocoa.framework on Windows and that won’t work

Actually, I noticed this issue with 2014r1.1 as well… I personally went through every declare in macoslib and made sure that they were wrapped in conditional compiles but still have the issue in 2014r1.1, so I went back to 2013r3.1 and everything works fine again… So it is not you or macoslib, but something that got changed somewhere along the way…

I think the missing TargetCocoa pragma is probably to be found in your code, not in macoslib.

I had this exact thing happen to me yesterday with a third party vendor that I own the source code version. In a minor fix, a Windows declare was mistakenly put under #Else instead of the #ElseIf TargetWin32 section. Keep looking, something is not in the right place.

Then how come it continues to run just fine in 2013r3.1 ?

Conclusion: it’s in your code.

Except the fact the code works perfectly fine in 2013r3.1 yet does not work in 2014r1.1… And this was just “open, remote debug to Windows” with no changes to the code-base, so obviously if there were missing conditional compile targets, it would effect every version of Xojo…

Opening MacOSLib on a windows machine & hitting run also gives the same error
So something isn’t wrapped in a #if target right - now to see if I can sort out what