Results 1 to 2 of 2
  1. #1
    New Member
    Join Date
    May 2016
    Location
    Netherlands
    Posts
    1
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    C++ unresolved external symbol

    Hello,
    I am new in this world and new in C++ programming, I try to solve a simple problem, I hope. Can you assist me?
    I wrote a minimal C++ program in VS2012 i.e.
    =============
    // vs-cpp : communicate with simconnect in FSX or Prepar3d

    #include <Windows.h>
    #include "SimConnect.h"

    HANDLE hSim = NULL;

    int tmain ()
    {
    HRESULT hr;

    hr = SimConnect_Open (&hSim, "Test", NULL, 0, 0, SIMCONNECT_OPEN_CONFIGINDEX_LOCAL );
    return 0;
    }
    ================
    It is compiling fine with Ctrl-F7
    Building F7 - compiling and linking - gives the error
    LNK2019: unresolved external symbol _SimConnect_Open@24 referenced in function "int __cdecl tmain(void)" (?tmain@@YAHXZ)
    My Properties | Linker | Commandline is:

    ==================
    /OUT:"E:\cpp\06_sim_open\Debug\hello.exe" /MANIFEST /NXCOMPAT /PDB:"E:\cpp\06_sim_open\Debug\hello.pdb" /DYNAMICBASE "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG /MACHINE:X86 /INCREMENTAL /PGD:"E:\cpp\06_sim_open\Debug\hello.pgd" /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"Debug\hello.exe.intermediate.manifest" /ERRORREPORT:PROMPT /NOLOGO /LIBPATH:"C:\Program Files (x86)\Windows Kits\8.0\Include\um" /LIBPATH:"G:\Prepar3D v3 SDK 3.2.2.16659\Utilities\SimConnect SDK\lib" /TLBID:1
    ==================
    which includes /LIBPATH:"G:\Prepar3D v3 SDK 3.2.2.16659\Utilities\SimConnect SDK\lib" and in that directory is SimConnect.lib

    I have no idea where to look for a sulution, I searched this forum but was unable to find a hint.
    Thanks in advance.

  2. #2
    500+ This must be a daytime job kiek's Avatar
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    698
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: C++ unresolved external symbol

    Hallo,

    1. Remove that /LIBPATH part.
    2. Put a copy of SimConnect.lib in the same folder as your program.
    3. Add SimConnect.lib in the Additional Options window (select Project properties->Linker->Command Line)

    Groeten,
    Nico
    Last edited by kiek; 05-26-2016 at 12:39 PM.