# Looking for hxcpp to create static lib and included files link into visual studio sln?

**URL:** <https://community.haxe.org/t/looking-for-hxcpp-to-create-static-lib-and-included-files-link-into-visual-studio-sln/3530>\
**Category:** Haxe\
**Created:** [April 26, 2022, 3:13am UTC](https://community.haxe.org/t/looking-for-hxcpp-to-create-static-lib-and-included-files-link-into-visual-studio-sln/3530 "2022-04-26T03:13:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zhan](https://community.haxe.org/user_avatar/community.haxe.org/zhan/32/468_2.png) [@Zhan](https://community.haxe.org/u/Zhan)\
**Post date:** [April 26, 2022, 3:13am UTC](https://community.haxe.org/t/looking-for-hxcpp-to-create-static-lib-and-included-files-link-into-visual-studio-sln/3530/1 "2022-04-26T03:13:21Z")

</div>

Looking for hxcpp to create static lib and included files link into visual studio sln?

is there any tutorial about that? thanks.

---

<div class="post-metadata">

**Author:** ![Zhan](https://community.haxe.org/user_avatar/community.haxe.org/zhan/32/468_2.png) [@Zhan](https://community.haxe.org/u/Zhan)\
**Post date:** [April 26, 2022, 4:07am UTC](https://community.haxe.org/t/looking-for-hxcpp-to-create-static-lib-and-included-files-link-into-visual-studio-sln/3530/2 "2022-04-26T04:07:38Z")

</div>

![image](https://community.haxe.org/uploads/default/original/2X/a/afaa410f644f4dad79cd74038cef1056e823426e.png)

```nohighlight
#include <iostream>
#include <hxcpp.h>
//include main.h
#include "Test.h"
#include "Main.h"

int main()
{
  

    Main_obj::main();
}

```

how to fixed this error

 ![image](https://community.haxe.org/uploads/default/original/2X/8/8de93b0725a555670179d41b5d9e3e0f2cb01a70.png)

---

<div class="post-metadata">

**Author:** ![haxiomic](https://community.haxe.org/user_avatar/community.haxe.org/haxiomic/32/75_2.png) [@haxiomic](https://community.haxe.org/u/haxiomic)\
**Post date:** [April 26, 2022, 7:23am UTC](https://community.haxe.org/t/looking-for-hxcpp-to-create-static-lib-and-included-files-link-into-visual-studio-sln/3530/3 "2022-04-26T07:23:59Z")

</div>

Haxe-C-Bridge might help

> **[GitHub - haxiomic/haxe-c-bridge: Easily interact with haxe classes from C...](https://github.com/haxiomic/haxe-c-bridge)**
>
> Easily interact with haxe classes from C with an automatically generated C header - GitHub - haxiomic/haxe-c-bridge: Easily interact with haxe classes from C with an automatically generated C header

Checkout the sample in test/unit/. In that case haxe code is compiled to a dll and used by a separate C program. A static lib could work too

---

<div class="post-metadata">

**Author:** ![Zhan](https://community.haxe.org/user_avatar/community.haxe.org/zhan/32/468_2.png) [@Zhan](https://community.haxe.org/u/Zhan)\
**Post date:** [April 26, 2022, 8:20am UTC](https://community.haxe.org/t/looking-for-hxcpp-to-create-static-lib-and-included-files-link-into-visual-studio-sln/3530/4 "2022-04-26T08:20:26Z")

</div>

I got some issue here

 ![image](https://community.haxe.org/uploads/default/original/2X/f/f69d5ad6655d3f37a971c652a3841a63f43c2e70.png)

my project is vc++

---

<div class="post-metadata">

**Author:** ![Zhan](https://community.haxe.org/user_avatar/community.haxe.org/zhan/32/468_2.png) [@Zhan](https://community.haxe.org/u/Zhan)\
**Post date:** [April 26, 2022, 8:49am UTC](https://community.haxe.org/t/looking-for-hxcpp-to-create-static-lib-and-included-files-link-into-visual-studio-sln/3530/5 "2022-04-26T08:49:19Z")

</div>

oh,I fixed by myself

 ![image](https://community.haxe.org/uploads/default/original/2X/7/7d4179169378212e963420fb60b6f8aa312c0316.png)

```cpp
#include <cstdio>

#include "hxcpp.h"
#include "HxcppConfig-19.h"

#include "fmt/core.h"
#include "Empty.h"

extern "C" {

	extern void hxcpp_set_top_of_stack();
	extern const char* hxRunLibrary();

	int run_haxe()
	{
		printf("fuck %s\n", "call from haxe");
		hxcpp_set_top_of_stack();

		const char* err = hxRunLibrary();

		if (err)
		{
			printf("Error %s\n", err);
			return -1;
		}

		return 0;
	} //run_haxe
}
int main(void) {
	// start the haxe thread

	fmt::print("Hello, World!\n");
	run_haxe();
	fmt::print("Hello, World!\n");

	
	Empty_obj::doTest();
	return 0;
}

```

and build.hxml

```haxe
-cp src
-main Empty
--cpp bin/cpp
-D static_link
-D HXCPP_M64

```
