Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    Visual Studio Micro Arduino linkin issues

    Visual Studio Micro Arduino linkin issues

    kayleejacob
    Member

    I currently have the same code working directly in Arduino IDE but i am tring to get it to compile in visual studio as i use this as my primary IDE iam getting following error i am using

    arduino 1.8

    latest IDF for esp32

    latest build for bsec 

    Linking it all together ...
    # Coping cached core C:\Users\Home\AppData\Local\Temp\VMBCore\arduino16x\7af14a94f13cbf1aa099fc9a40549e1d\core.a to C:\Users\Home\AppData\Local\Temp\VMBuilds\MainMod0\expressif_d32_pro\Release\core.a
    "C:\Users\Home\Documents\Arduino\hardware\expressif\esp32/tools/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc" -nostdlib "-LC:\Users\Home\Documents\Arduino\hardware\expressif\esp32/tools/sdk/lib" "-LC:\Users\Home\Documents\Arduino\hardware\expressif\esp32/tools/sdk/ld" -T esp32_out.ld -T esp32.project.ld -T esp32.rom.ld -T esp32.peripherals.ld -T esp32.rom.libgcc.ld -T esp32.rom.spiram_incompatible_fns.ld -u ld_include_panic_highint_hdl -u call_user_start_cpu0 -Wl,--gc-sections -Wl,-static -Wl,--undefined=uxTopUsedPriority -u __cxa_guard_dummy -u __cxx_fatal_exception -Wl,--start-group "MainMod0.cpp.o" "ADC.cpp.o" "BME680P.cpp.o" "i2c.cpp.o" "power.cpp.o" "variable.cpp.o" "EEPROM\EEPROM.cpp.o" "bsec\bsec.cpp.o" "bsec\bme680\bme680.c.o" "Wire\Wire.cpp.o" "SPI\SPI.cpp.o" "bme680_data\bme680_data.cpp.o" "bme680_data\bme680\bme680.c.o" "C:\Users\Home\AppData\Local\Temp\VMBuilds\MainMod0\expressif_d32_pro\Release\core.a" -lgcc -lfreertos -lmesh -lod -lwear_levelling -lfb_gfx -lesp_adc_cal -lc_nano -lesp32 -ldriver -lhal -ljsmn -lsmartconfig -lesp_http_server -lprotocomm -lface_recognition -lespnow -ltcpip_adapter -lface_detection -lunity -lc -llibsodium -lesp_http_client -lapp_update -lnewlib -lcxx -ltcp_transport -lm -lefuse -lopenssl -lwifi_provisioning -lespcoredump -llog -lmbedtls -lesp_ringbuf -lwps -lnet80211 -lmqtt -lesp_https_server -lapp_trace -lesp_event -lesp32-camera -lsoc -lheap -llwip -lwpa -lrtc -lxtensa-debug-module -lspi_flash -lphy -lfr -lconsole -lcoap -lbtdm_app -lsdmmc -lfd -lmicro-ecc -ljson -lcore -lprotobuf-c -lethernet -lspiffs -lnvs_flash -lwpa_supplicant -lvfs -lasio -lwpa2 -lpp -lbootloader_support -limage_util -ldl_lib -lulp -lnghttp -lpthread -lfreemodbus -lexpat -lfatfs -lsmartconfig_ack -lmdns -lcoexist -lesp-tls -lesp_https_ota -lbt -lstdc++ -Wl,--end-group -Wl,-EL -o "C:\Users\Home\AppData\Local\Temp\VMBuilds\MainMod0\expressif_d32_pro\Release/MainMod0.ino.elf"
    bsec.cpp.o: file not recognized: File truncated
     
    collect2.exe*: error: ld returned 1 exit status
    Error linking for board LOLIN D32 PRO
    Build failed for project 'MainMod0'
    6 REPLIES 6

    kayleejacob
    Member

    i have reset machine now getting this error log

    Linking it all together ...
    # Coping cached core C:\Users\Home\AppData\Local\Temp\VMBCore\arduino16x\d5ad07ab6a6c7ab2f2f075fbd54898b4\core.a to C:\Users\Home\AppData\Local\Temp\VMBuilds\MainMod0\expressif_d32_pro\Release\core.a
    "C:\Users\Home\Documents\Arduino\hardware\expressif\esp32/tools/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc" -nostdlib "-LC:\Users\Home\Documents\Arduino\hardware\expressif\esp32/tools/sdk/lib" "-LC:\Users\Home\Documents\Arduino\hardware\expressif\esp32/tools/sdk/ld" -T esp32_out.ld -T esp32.project.ld -T esp32.rom.ld -T esp32.peripherals.ld -T esp32.rom.libgcc.ld -T esp32.rom.spiram_incompatible_fns.ld -u ld_include_panic_highint_hdl -u call_user_start_cpu0 -Wl,--gc-sections -Wl,-static -Wl,--undefined=uxTopUsedPriority -u __cxa_guard_dummy -u __cxx_fatal_exception -Wl,--start-group "MainMod0.cpp.o" "ADC.cpp.o" "BME680P.cpp.o" "i2c.cpp.o" "power.cpp.o" "variable.cpp.o" "EEPROM\EEPROM.cpp.o" "bsec\bsec.cpp.o" "bsec\bme680\bme680.c.o" "Wire\Wire.cpp.o" "SPI\SPI.cpp.o" "bme680_data\bme680_data.cpp.o" "bme680_data\bme680\bme680.c.o" "C:\Users\Home\AppData\Local\Temp\VMBuilds\MainMod0\expressif_d32_pro\Release\core.a" -lgcc -lfreertos -lmesh -lod -lwear_levelling -lfb_gfx -lesp_adc_cal -lc_nano -lesp32 -ldriver -lhal -ljsmn -lsmartconfig -lesp_http_server -lprotocomm -lface_recognition -lespnow -ltcpip_adapter -lface_detection -lunity -lc -llibsodium -lesp_http_client -lapp_update -lnewlib -lcxx -ltcp_transport -lm -lefuse -lopenssl -lwifi_provisioning -lespcoredump -llog -lmbedtls -lesp_ringbuf -lwps -lnet80211 -lmqtt -lesp_https_server -lapp_trace -lesp_event -lesp32-camera -lsoc -lheap -llwip -lwpa -lrtc -lxtensa-debug-module -lspi_flash -lphy -lfr -lconsole -lcoap -lbtdm_app -lsdmmc -lfd -lmicro-ecc -ljson -lcore -lprotobuf-c -lethernet -lspiffs -lnvs_flash -lwpa_supplicant -lvfs -lasio -lwpa2 -lpp -lbootloader_support -limage_util -ldl_lib -lulp -lnghttp -lpthread -lfreemodbus -lexpat -lfatfs -lsmartconfig_ack -lmdns -lcoexist -lesp-tls -lesp_https_ota -lbt -lstdc++ -Wl,--end-group -Wl,-EL -o "C:\Users\Home\AppData\Local\Temp\VMBuilds\MainMod0\expressif_d32_pro\Release/MainMod0.ino.elf"
     
    bme680.c.o: In function bme680_get_regs
    bme680.c:326: multiple definition of bme680_get_regs
    bme680.c.o: C:\Users\Home\Documents\Arduino\libraries\bsec\src\bme680\bme680.c:316: first defined here
     
    bme680.c.o: In function bme680_set_regs
    bme680.c*: (.text.bme680_set_regs+0x0): multiple definition of bme680_set_regs
    bme680.c.o: bme680.c:(.text.bme680_set_regs+0x0): first defined here
     
    Error linking for board LOLIN D32 PRO
    bme680.c.o: In function bme680_soft_reset
    Build failed for project 'MainMod0'
    bme680.c*: (.text.bme680_soft_reset+0x0): multiple definition of bme680_soft_reset
    bme680.c.o: bme680.c:(.text.bme680_soft_reset+0x0): first defined here
     
    bme680.c.o: In function bme680_init
    bme680.c*: (.text.bme680_init+0x0): multiple definition of bme680_init
    bme680.c.o: bme680.c:(.text.bme680_init+0x0): first defined here
     
    bme680.c.o: In function bme680_get_sensor_settings
    bme680.c*: (.text.bme680_get_sensor_settings+0x0): multiple definition of bme680_get_sensor_settings
    bme680.c.o: bme680.c:(.text.bme680_get_sensor_settings+0x0): first defined here
     
    bme680.c.o: In function bme680_set_sensor_mode
    bme680.c*: (.text.bme680_set_sensor_mode+0x0): multiple definition of bme680_set_sensor_mode
    bme680.c.o: bme680.c:(.text.bme680_set_sensor_mode+0x0): first defined here
     
    bme680.c.o: In function bme680_set_sensor_settings
    bme680.c*: (.text.bme680_set_sensor_settings+0x0): multiple definition of bme680_set_sensor_settings
    bme680.c.o: bme680.c:(.text.bme680_set_sensor_settings+0x0): first defined here
     
    bme680.c.o: In function bme680_get_sensor_mode
    bme680.c*: (.text.bme680_get_sensor_mode+0x0): multiple definition of bme680_get_sensor_mode
    bme680.c.o: bme680.c:(.text.bme680_get_sensor_mode+0x0): first defined here
     
    bme680.c.o: In function bme680_set_profile_dur
    bme680.c*: (.text.bme680_set_profile_dur+0x0): multiple definition of bme680_set_profile_dur
    bme680.c.o: bme680.c:(.text.bme680_set_profile_dur+0x0): first defined here
     
    bme680.c.o: In function bme680_get_profile_dur
    bme680.c*: (.text.bme680_get_profile_dur+0x0): multiple definition of bme680_get_profile_dur
    bme680.c.o: bme680.c:(.text.bme680_get_profile_dur+0x0): first defined here
     
    bme680.c.o: In function bme680_get_sensor_data
    bme680.c*: (.text.bme680_get_sensor_data+0x0): multiple definition of bme680_get_sensor_data
    bme680.c.o: bme680.c:(.text.bme680_get_sensor_data+0x0): first defined here
    bsec.cpp.o: (.literal._ZN4Bsec11beginCommonEv+0x0): undefined reference to bsec_init
    bsec.cpp.o: (.literal._ZN4Bsec11beginCommonEv+0x4): undefined reference to bsec_get_version
    bsec.cpp.o: (.literal._ZN4Bsec18updateSubscriptionEP21bsec_virtual_sensor_thf+0x0): undefined reference to bsec_update_subscription
    bsec.cpp.o: (.literal._ZN4Bsec8getStateEPh+0x0): undefined reference to bsec_get_state
    bsec.cpp.o: (.literal._ZN4Bsec8setStateEPh+0x0): undefined reference to bsec_set_state
    bsec.cpp.o: (.literal._ZN4Bsec9setConfigEPKh+0x0): undefined reference to bsec_set_configuration
    bsec.cpp.o: (.literal._ZN4Bsec15readProcessDataEx19bsec_bme_settings_t+0x8): undefined reference to bsec_do_steps
    bsec.cpp.o: (.literal._ZN4Bsec3runEv+0x0): undefined reference to bsec_sensor_control
     
    bsec.cpp.o: In function Bsec::beginCommon()
    bsec.cpp:375: undefined reference to bsec_init
     
    bsec.cpp.o: In function Bsec::getVersion()
    bsec.cpp:375: undefined reference to bsec_get_version
     
    bsec.cpp.o: In function Bsec::updateSubscription(bsec_virtual_sensor_t*, unsigned char, float)
    bsec.cpp:375: undefined reference to bsec_update_subscription
     
    bsec.cpp.o: In function Bsec::getState(unsigned char*)
    bsec.cpp:375: undefined reference to bsec_get_state
     
    bsec.cpp.o: In function Bsec::setState(unsigned char*)
    bsec.cpp:375: undefined reference to bsec_set_state
     
    bsec.cpp.o: In function Bsec::setConfig(unsigned char const*)
    bsec.cpp:375: undefined reference to bsec_set_configuration
     
    bsec.cpp.o: In function Bsec::readProcessData(long long, bsec_bme_settings_t)
    bsec.cpp:288: undefined reference to bsec_do_steps
     
    bsec.cpp.o: In function Bsec::run()
    bsec.cpp:174: undefined reference to bsec_sensor_control
     
    collect2.exe*: error: ld returned 1 exit status

    i have gotten down to this error now my issue is it is working in arduino directly 

    Linking it all together ...
    # Coping cached core C:\Users\Home\AppData\Local\Temp\VMBCore\arduino16x\85035866b9b756aae135cc0b7da7261c\core.a to C:\Users\Home\AppData\Local\Temp\VMBuilds\MainMod0\esp32_d32_pro\Release\core.a
    "C:\Users\Home\AppData\Local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0/bin/xtensa-esp32-elf-gcc" -nostdlib "-LC:\Users\Home\AppData\Local\arduino15\packages\esp32\hardware\esp32\1.0.4/tools/sdk/lib" "-LC:\Users\Home\AppData\Local\arduino15\packages\esp32\hardware\esp32\1.0.4/tools/sdk/ld" -T esp32_out.ld -T esp32.common.ld -T esp32.rom.ld -T esp32.peripherals.ld -T esp32.rom.libgcc.ld -T esp32.rom.spiram_incompatible_fns.ld -u ld_include_panic_highint_hdl -u call_user_start_cpu0 -Wl,--gc-sections -Wl,-static -Wl,--undefined=uxTopUsedPriority -u __cxa_guard_dummy -u __cxx_fatal_exception -Wl,--start-group "MainMod0.cpp.o" "ADC.cpp.o" "BME680P.cpp.o" "i2c.cpp.o" "power.cpp.o" "variable.cpp.o" "Wire\Wire.cpp.o" "SPI\SPI.cpp.o" "EEPROM\EEPROM.cpp.o" "bsec\bsec.cpp.o" "bsec\bme680\bme680.c.o" "C:\Users\Home\AppData\Local\Temp\VMBuilds\MainMod0\esp32_d32_pro\Release\core.a" -lgcc -lesp32 -lphy -lesp_http_client -lmbedtls -lrtc -lesp_http_server -lbtdm_app -lspiffs -lbootloader_support -lmdns -lnvs_flash -lfatfs -lpp -lnet80211 -ljsmn -lface_detection -llibsodium -lvfs -ldl_lib -llog -lfreertos -lcxx -lsmartconfig_ack -lxtensa-debug-module -lheap -ltcpip_adapter -lmqtt -lulp -lfd -lfb_gfx -lnghttp -lprotocomm -lsmartconfig -lm -lethernet -limage_util -lc_nano -lsoc -ltcp_transport -lc -lmicro-ecc -lface_recognition -ljson -lwpa_supplicant -lmesh -lesp_https_ota -lwpa2 -lexpat -llwip -lwear_levelling -lapp_update -ldriver -lbt -lespnow -lcoap -lasio -lnewlib -lconsole -lapp_trace -lesp32-camera -lhal -lprotobuf-c -lsdmmc -lcore -lpthread -lcoexist -lfreemodbus -lspi_flash -lesp-tls -lwpa -lwifi_provisioning -lwps -lesp_adc_cal -lesp_event -lopenssl -lesp_ringbuf -lfr -lstdc++ -Wl,--end-group -Wl,-EL -o "C:\Users\Home\AppData\Local\Temp\VMBuilds\MainMod0\esp32_d32_pro\Release/MainMod0.ino.elf"
    bsec.cpp.o: (.literal._ZN4Bsec11beginCommonEv+0x0): undefined reference to bsec_init
    bsec.cpp.o: (.literal._ZN4Bsec11beginCommonEv+0x4): undefined reference to bsec_get_version
    bsec.cpp.o: (.literal._ZN4Bsec18updateSubscriptionEP21bsec_virtual_sensor_thf+0x0): undefined reference to bsec_update_subscription
    bsec.cpp.o: (.literal._ZN4Bsec8getStateEPh+0x0): undefined reference to bsec_get_state
    Error linking for board LOLIN D32 PRO
    bsec.cpp.o: (.literal._ZN4Bsec8setStateEPh+0x0): undefined reference to bsec_set_state
    Build failed for project 'MainMod0'
    bsec.cpp.o: (.literal._ZN4Bsec9setConfigEPKh+0x0): undefined reference to bsec_set_configuration
    bsec.cpp.o: (.literal._ZN4Bsec15readProcessDataEx19bsec_bme_settings_t+0x4): undefined reference to bsec_do_steps
    bsec.cpp.o: (.literal._ZN4Bsec3runEv+0x0): undefined reference to bsec_sensor_control
     
    bsec.cpp.o: In function Bsec::beginCommon()
    bsec.cpp:375: undefined reference to bsec_init
     
    bsec.cpp.o: In function Bsec::getVersion()
    bsec.cpp:375: undefined reference to bsec_get_version
     
    bsec.cpp.o: In function Bsec::updateSubscription(bsec_virtual_sensor_t*, unsigned char, float)
    bsec.cpp:375: undefined reference to bsec_update_subscription
     
    bsec.cpp.o: In function Bsec::getState(unsigned char*)
    bsec.cpp:375: undefined reference to bsec_get_state
     
    bsec.cpp.o: In function Bsec::setState(unsigned char*)
    bsec.cpp:375: undefined reference to bsec_set_state
     
    bsec.cpp.o: In function Bsec::setConfig(unsigned char const*)
    bsec.cpp:375: undefined reference to bsec_set_configuration
     
    bsec.cpp.o: In function Bsec::readProcessData(long long, bsec_bme_settings_t)
    bsec.cpp:291: undefined reference to bsec_do_steps
     
    bsec.cpp.o: In function Bsec::run()
    bsec.cpp:174: undefined reference to bsec_sensor_control
     
    collect2.exe*: error: ld returned 1 exit status

    "Undefined reference to" BSEC functions is typically due to linking issues. In particular, I don't see the BSEC library being part of the linker flags in you snippet (i.e. at least "-lalgobsec" seems missing, eventually including its directory may be needed too). Adding this flag should (as required by your specific toolchain) should solve this issue.

    Is there a location i could check as the file spefiied is in the correct folder and this works direct in the arduino IDE and ijust cant get it working in Visual studio.

     

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist