0

I have three projects within one solution. I am building two static libraries and trying to link them to my executable project (called ensemble). I have added both .lib file directories to my Linker/General and Linker/Input library directories inside the ensemble project.

Inside one of my static library projects I have the following:

acquisition.cpp

#include "acquisition.h"

//other stuff

int run_acquisition() {
   //runs function
}

acquisition.h

#pragma once
int run_acquisition();

Inside of ensemble, I have the following:

#include "acquisition.h"

int main(void) {
    run_acquisition();


    return 0;
}

In which case I get the error that "identifier "run_acquisition" is undefined". The program sees acquisition.h but I can't seem to figure out the issue to debug this. Welcome to any feedback!

Update #1: I fixed the typo. Here is the build log -

3>------ Build started: Project: ensemble, Configuration: Debug x64 ------
3>main.cpp
3>main.obj : error LNK2019: unresolved external symbol "int __cdecl run_acquisition(void)" (?run_acquisition@@YAHXZ) referenced in function main
3>C:\XIMEA\Examples\Bin\ximea_camera.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
3>C:\MirrorcleTech\SDK-Cpp\x64\Debug\ensemble.exe : fatal error LNK1120: 1 unresolved externals
3>Done building project "ensemble.vcxproj" -- FAILED.
Ryanator13
  • 17
  • 5
  • Please post the full exact error message copied from the build output window – Alan Birtles Sep 19 '19 at 15:52
  • 1
    Check your spelling, `acquisition` is a tricky word to type – Alan Birtles Sep 19 '19 at 15:53
  • Compile or linker error? – Mansoor Sep 19 '19 at 15:56
  • In your `acquisition.h` you have a typo: `int run_acquis[i]tion();`. – Adrian Mole Sep 19 '19 at 15:56
  • Fixed the issue with the typo - now getting a build error within the project. – Ryanator13 Sep 19 '19 at 16:21
  • 1
    pay attention to your warnings: `warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'` you are mixing 32-bit and 64-bit code – Alan Birtles Sep 19 '19 at 16:23
  • @AlanBirtles The two supporting projects are in 32-bit and 64-bit, but I want to interact with both. What would be the fix to working with both? – Ryanator13 Sep 19 '19 at 16:33
  • You need to build **all** modules in the same configuration (either `x86` or `x64`); you ***cannot*** link `x64` object libraries with `x86` executables, or *vice-versa*. – Adrian Mole Sep 19 '19 at 16:45
  • My guess was that unresolved external symbol "int __cdecl run_acquisition(void)……"messages had been caused by the fact that it could not link the acquisition library due to the wrong architecture type.And the messages "library machine type 'x86' conflicts with target machine type 'x64'" still indicate that there is something wrong with this setting.I suggest you could refer to the [link](https://stackoverflow.com/questions/3563756/fatal-error-lnk1112-module-machine-type-x64-conflicts-with-target-machine-typ) – Jeaninez - MSFT Sep 20 '19 at 02:32

0 Answers0