Unresolved externals - Please help!

I have 2 projects

p1:
GestureDLL.cpp

p2:
Main.h
Main.cpp

I am trying to call functions from p1 so that I can export them in the DLL from p2. I have added additional dependecies to the folder where Main.h lies, but am still recieving the error. Could someone please help!!


***************GestureDLL.cpp*********
// GestureDLL.cpp : Defines the exported functions for the DLL application.
//
#pragma once
#pragma comment(lib, "mchp_hmi.lib")
#include "stdafx.h"
//#include <hmi_api.h>
//#include <hmi_dynamic.h>
//#include <hmi_static.h>
#include <stdio.h>
#include <Windows.h>
#include <stdio.h>
#include <conio.h>
#include <Main.h>

using namespace std;

extern "C"
{
__declspec(dllexport) int Get3DX2()
{
//return 1;
return Get3DX();
}

__declspec(dllexport) int Start2()
{
return 1;
//return Start();
}

}

*****************Main.h*********************
#pragma once

#include <hmi_api.h>
#include <hmi_dynamic.h>
#include <hmi_static.h>
#include <iostream>
using namespace std;

extern "C"
{
int Get3DX();
int Start();
}

typedef struct
{
int running;
int menu_current;
int auto_calib;
int last_gesture;
int touch_detect;
int air_wheel;
int last_mouse;
int mouse_countdown;

/* Common */
hmi_t *hmi;

/* 3D */
hmi3d_position_t *out_pos;
hmi3d_gesture_t *out_gesture;
hmi3d_signal_t *out_sd;
hmi3d_calib_t *out_calib;
hmi3d_touch_t *out_touch;
hmi3d_air_wheel_t *out_air_wheel;

/* 2D */
hmi2d_finger_pos_list_t *fingers;
hmi2d_mouse_t *mouse;
} data_t;



***********************Main.cpp*****************
#pragma once

#include <stdio.h>
#include "Main.h"

using namespace std;
//
//class Main{
data_t data;

int Start()
{
hmi_t *hmi = hmi_create();


const hmi3d_position_t * pos = hmi3d_get_position(hmi);
const hmi3d_gesture_t * gesture = hmi3d_get_gesture(hmi);
int last_gesture = 0;

const int stream_flags = hmi3d_DataOutConfigMask_xyzPosition |
hmi3d_DataOutConfigMask_GestureInfo;

hmi2d_finger_pos_list_t *fingers = hmi2d_get_finger_positions(hmi);

// Create hmi_t instance

//if (hmi3d_set_output_enable_mask(&hmi, stream_flags, stream_flags,
// hmi3d_DataOutConfigMask_OutputAll, 100) < 0)
//{
// fprintf(stderr, "Error: could not set output mask\n");
// //exit(-1);
//}

if (!hmi) {
fprintf(stderr, "Could not allocate hmi_t instance\n");
return -1;
}

// Initialize hmi
hmi_initialize(hmi);

// Connect to device
if (hmi_open(hmi) != HMI_NO_ERROR) {
fprintf(stderr, "Could not connect to HMI device\n");
return -1;
}

printf("Succesfully connected to HMI device\n");

/* Update device and menu until quit */
while (1) {
while (hmi2d_retrieve_data(hmi) == HMI_NO_ERROR) {
data.out_pos = hmi3d_get_position(hmi);
}

// TODO Do other things like sleep etc.
}
// Use hmi...

// Disconnect from device
hmi_close(hmi);

// Cleanup
hmi_cleanup(hmi);

// And finally freeing the hmi_t instance
hmi_free(hmi);

return -1;
}

int Get3DX()
{
return 5;// data.out_pos->x;
}

//};




Topic archived. No new replies allowed.