I cant resolve this external symbol
Jul 6, 2018 at 2:49pm UTC
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!!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
***************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;
}
//};
Last edited on Jul 6, 2018 at 2:50pm UTC
Jul 6, 2018 at 5:10pm UTC
did you remember to include the lib file that goes with the dll file? Check to see if the dll generation project produces one.
Last edited on Jul 6, 2018 at 5:11pm UTC
Jul 7, 2018 at 6:59pm UTC
Thanks...Im an idiot lol
Topic archived. No new replies allowed.