Error when compiling with luajit and lua-iup libs [visual c++ 2012] - visual-c++

I wrote an app with luajit and lua-iup, and link my app with static libs. But I got the following error:
------ Build started: Project: ConsoleApplication1, Configuration: Release Win32 ------
Creating library C:\Users\root\Documents\Visual Studio 2012\Projects\ConsoleApplication1\Release\ConsoleApplication1.lib and object C:\Users\root\Documents\Visual Studio 2012\Projects\ConsoleApplication1\Release\ConsoleApplication1.exp
iup.lib(iupwindows_main.obj) : error LNK2001: unresolved external symbol _main
C:\Users\root\Documents\Visual Studio 2012\Projects\ConsoleApplication1\Release\ConsoleApplication1.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Am I missing some libs and any idea about this?

As far as I know, IUP's Lua bindings are partially written in Lua. That wouldn't ordinarily be a problem, except that the Lua parts are compiled into the library as pre-compiled bytecode. Lua bytecode and LuaJIT bytecode are different.
The right answer is to change IUP so that it builds with Lua source compiled in rather than bytecode. That will conceivably slow down the startup of an IUP application, but it will make it easier to cross compile IUP and make it possible to use LuaJIT instead of standard Lua.

Here is the answer form the author of IUP, hope this would be helpful to someone that met the same problem as me
It seems that you are building a console application. This means you
need a “main” function. If you try instead to build a Windows
application without a console, then IUP will implement the WinMain
function for you and call your “main” function. In both cases you need
the “main” function.

Related

Haxe: How to use a .NET C++/CLI dll in haxe code?

I've been trying to use Haxe to generate C# code that calls methods from a dll written in C++/CLR. This dll is called "AudioClientSDK.dll"
Here is an example of the Haxe code I'm trying:
package hello;
class HelloWorld {
static public function main():Void {
var s = untyped __cs__("AudioClientCLR.AudioClientAPI.release()");
}
}
As you can see I'm using "Haxe magic" syntax (I previously tried Haxe extern classes that resulted pretty much in the same problems) to directly call the release method within the AudioClientSDK.dll. The method signature inside the dll is:
public : void AudioClientCLR::AudioClientAPI::release()
However, when I try to compile this code, Haxe throws this error:
haxe -cp src -cs out/CS -main hello.HelloWorld
haxelib run hxcs hxcs_build.txt --haxe-version 3103
c:\git\HelloHaxe\src\hello\HelloWorld.hx(6,16): error CS0103: The name
'AudioClientCLR' does not exist in the current context
Compilation error
Native compilation failed
Error: Build failed
If I try to pass the AudioClientSDK.dll reference as -net-lib or -net-std I get these errors:
haxe -cp src -cs out/CS -net-lib lib/CPP/x86/AudioClientSDK.dll -main hello.HelloWorld
File "ilMetaReader.ml", line 281, characters 36-42: Assertion failed
error 0x2
haxe -cp src -cs out/CS -net-std lib/CPP/x86/AudioClientSDK.dll -main hello.HelloWorld
Error: No .NET std lib directory with the pattern 'net-20' was found in the -net-std search path. Try updating the hxcs lib to the latest version, or specifying another -net-std path.
Do any of you know how to correctly use the dll?
Thanks in advance.
P.S. These are some properties of the AudioClientSDK.dll:
Targeted framework: .NETFramework,Version=v4.0
Platform: Win32
Platform Toolset: VisualStudio 2010 (v100)
Use of MFC: Use MFC in a Shared DLL
Common Language Runtime: Common Language Runtime Support (/clr)
Also, please note that this dll can be used without problems from C# in Visual Studio.
This seems like a bug. Please report it ASAP to the haxe issue list, with a downloadable link to the offending dll, and it might get included inyo the 3.2 final release

DX11 Unresolved Externals

1>------ Build started: Project: Setup, Configuration: Debug Win32 ------
1>BoxDemo.obj : error LNK2019: unresolved external symbol _D3DX11CreateEffectFromMemory#24 referenced in function "private: void __thiscall BoxApp::BuildFX(void)" (?BuildFX#BoxApp##AAEXXZ)
1>C:\Users\Josh\Documents\Game Institute\DirectX\Chapter 1\Projects\Setup\Debug\Setup.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I'm using VS2012 and trying to setup DX11 using a sample program from Frank D Lunas DX11 book. I have no idea what this error message means, any help would be appreciated.
1>------ Build started: Project: Setup, Configuration: Debug Win32 ------
1>Effects11d.lib(EffectAPI.obj) : error LNK2019: unresolved external symbol _D3DCompileFromFile#36 referenced in function _D3DX11CompileEffectFromFile
1>C:\Users\Josh\Documents\Game Institute\DirectX\Chapter 1\Projects\Setup\Debug\Setup.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Linker cannot find definition of D3DX11CreateEffectFromMemory function. This function is a part of Effects11 framework. And you need to link Effects11.lib to build this program.
Previously, to develop DirectX apps, you must have been DirectX SDK installed.
Now that stand-alone DirectX SDK concerned legacy and now it is a part of Windows SDK (since version 8.0). You`ve got it when installed Visual Studio 2012.
The problem is now this SDK version doesn't include Effect11 framework, among other things.
There are several ways to fix this problems:
Download and install legacy DirectX SDK. When compiling you will get some warnings, because of conflicting old DirectX SDK and new Windows SDK. To solve this you can switch to your project to v110xp toolset or install Windows 7 SDK and switch to v100 in project's options.
In case of this sample program, Mr. Luna included compiled libs in Common folder of source code archive. But I'm not sure if it will work with Win8 SDK.
Correct source code and strip out Effect11 stuff. If you just learning DirectX, it is not easy way.
Some more explanation from Chuck Walbourn - MSFT:
Where is the DirectX SDK?
Effects for Direct3D 11 Update

Weird linking error

My application is giving me a linking error when I try to build it.
Error 5 error LNK2001: unresolved external symbol "int __cdecl _AfxInitManaged(void)" (?_AfxInitManaged##YAHXZ) mfcs80ud.lib
I am building the application using Visual studio 2005. I am also linking against WINDDK for Server 2003 and Windows 6.1 SDK if this helps.
I Googled around and noticed people saying that its a precompiled header issue and it should be fixed by setting the /Yc switch in the stdafx.cpp Create/Use Precompiled header property. but that did not fix it for me and I'm not sure how to fix this.
Can someone help please.
I had same problem with Visual Studio 2010.
error LNK2001: unresolved external symbol "int __cdecl _AfxInitManaged
It turned out that was from my mistake to include another stdafx.cpp in other project.
Including more than one stdafx.cpp will produce this symptom.
Seems it solved it self once I restarted my machine.. not sure what was causing it in the first place, even restarting VS and cleaning the solution a gazillion times did not work.
Using Visual Studio 2005 to build a .NET 2003 solution, I encountered the described LNK2001 error. The project did not have a stdafx.cpp file. I added a copy of stdafx.cpp to the project and it built successfully.

ServiceStack Monotouch iPhone/Release Build Fails

UPDATE - This indeed fails only in release builds, but only when the LLVM compiler option is used. Creating a self-contained test case for Xamarin that I'll post as the answer.
I have a project which uses the ServiceStack.Common.Monotouch.dll, ServiceStack.Interfaces.Monotouch.dll, and ServiceStack.Text.Monotouch.dll. I can build this project in Simulator/Release & Debug, and iPhone/Debug, but when I build in iPhone/Release, I get the following error:
...
MONO_PATH=/Users/pseabury/Projects/IMDSS_iOS/IMDSSMobile_iOS/bin/iPhone/Release/IMDSSMobile_iOS.app /Developer/MonoTouch/usr/bin/arm-darwin-mono --llvm --aot=mtriple=armv7-darwin,full,static,asmonly,nodebug,llvm-path=/Developer/MonoTouch/LLVM/bin/,outfile=/var/folders/mt/b7h3_pgs3lxgpvpm2h1_2ppc0000gn/T/tmp39b8b8c7.tmp/System.Data.dll.7.s "/Users/pseabury/Projects/IMDSS_iOS/IMDSSMobile_iOS/bin/iPhone/Release/IMDSSMobile_iOS.app/System.Data.dll"
AOT Compilation exited with code 134, command:
MONO_PATH=/Users/pseabury/Projects/IMDSS_iOS/IMDSSMobile_iOS/bin/iPhone/Release/IMDSSMobile_iOS.app /Developer/MonoTouch/usr/bin/arm-darwin-mono --llvm --aot=mtriple=armv7-darwin,full,static,asmonly,nodebug,llvm-path=/Developer/MonoTouch/LLVM/bin/,outfile=/var/folders/mt/b7h3_pgs3lxgpvpm2h1_2ppc0000gn/T/tmp39b8b8c7.tmp/ServiceStack.Text.MonoTouch.dll.7.s "/Users/pseabury/Projects/IMDSS_iOS/IMDSSMobile_iOS/bin/iPhone/Release/IMDSSMobile_iOS.app/ServiceStack.Text.MonoTouch.dll"
Mono Ahead of Time compiler - compiling assembly /Users/pseabury/Projects/IMDSS_iOS/IMDSSMobile_iOS/bin/iPhone/Release/IMDSSMobile_iOS.app/ServiceStack.Text.MonoTouch.dll
* Assertion at ../../../../../mono/mono/mini/mini-llvm.c:4535, condition `LLVMTypeOf (values [sreg1]) == LLVMTypeOf (values [phi->dreg])' not met
...
mtouch exited with code 1
If necessary I can put together an example project, but all you should need is the latest ServiceStack dlls or sources for Monotouch and a sample/contrived DTO for a ServiceClient in order to reproduce this.
Bug submitted to Xamarin - https://bugzilla.xamarin.com/show_bug.cgi?id=6066 .

What is the problem with linking of Pthreads libraries to .c file in MSVC++6?

Could someone please help me to compile my .c file with MSVC++6 in windows xp? From this morning, I am trying to compile it but it give me the following errors:
--------------------Configuration: server_th - Win32 Debug--------------------
Linking...
server_thread.obj : error LNK2001: unresolved external symbol _ThreadMain
Debug/server_th.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
server_th.exe - 2 error(s), 0 warning(s)
The same file was compiled in Unix but in windows xp, I don't know what is the matter with it. Even when I changed "run-time library" to Debug Multithreaded or Debug Multithreaded DLL, the errors are the same .
So,I would be glad if somneone would help me with it...
Thanks in advance for your, replies
i guess MSVC6 only recognize program execution starting point of either main(intargc,charargv[],charenvp[]) or wmain(intargc,wchar_targv[],wchar_tenvp[]) for wide char version.
perhaps you forgot to link in files containing the _ThreadMain subroutine?

Resources