VS code run and debug failed because undefined reference to external file ('test3.c') - visual-studio-code

Test2 is main function reference to test3.
Both functions are in different files.
It produce error.C_and_CPP/test2.c:12: undefined reference to `test3'

Related

TypeError: Cannot read property 'call' of undefined

So basically I am just getting started with Truffle and I have created my first Solidity code, which looks like this:
pragma solidity ^0.4.4;
contract HelloWorld
{
function SayHello() internal pure returns (string)
{
return ("Hello World!");
}
}
I then opened Powershell and ran the following command: testrpc Than I compiled and migrated my code using "truffle" compile and "truffle migrate"
The problems started occurring when I opened "truffle console" and did this, giving me an error at the end:
PS C:\Users**\MetaCoin> truffle console
truffle(development)> var hw
undefined
truffle(development)> HelloWorld.deployed().then(function(deployed){hw=deployed});
undefined
truffle(development)> hw.SayHello.call()
TypeError: Cannot read property 'call' of undefined
truffle(development)>
Can someone help me with this? Thanks.

"Undefined function or variable" loadAudioPlugin

I am trying to run this simple command on Matlab to load a VST:
hostedPlugin = loadAudioPlugin(pluginpath)
However, I am getting the following error: Undefined function or variable 'loadAudioPlugin'.
What's wrong? I can't seem to figure it out... This is the output I get when I type the "ver" command:
...
Audio System Toolbox Version 1.2 (R2017a)
...
The Audio system toolbox seems to be installed correctly. And the path is set correctly apparently, I can see the "loadAudioPlugin.p" file in the compiled folder.
Any ideas why Matlab says the loadAudioPlugin is not a function??

POSTGRESQL - ERROR: could not load library pgafis.so : undefined symbol: lfsparms_V2

I'm using PGAFIS library for fingerprint matching. For this i have installed postgresql and having some user defined c functions.
PGAFIS contain makefile, .control file, sql and unpacked sql file everything
I have compiled and pgafis.so file for the same and everyfile is on right location.
In my PGAdmin-III when i run CREATE EXTENSION pgafis it gives me following error:
ERROR: could not load library "/usr/lib/postgresql/9.4/lib/pgafis.so": /usr/lib/postgresql/9.4/lib/pgafis.so: undefined symbol: lfsparms_V2
SQL state: XX000
Please help. Thanks in advance
(This is a follow-up from Postgresql user defined c function issues)
I expect you forgot to link to the required library.
Try adding
PG_LIBS = -lmindtct
or whatever. If it's not on the default linker path you'll need to need to add -L/path/to/the/containing/directory to PG_CPPFLAGS too.

Errors in linking fortran code that imports a MAT-file [duplicate]

This question already has an answer here:
Reading data from matlab files into C
(1 answer)
Closed 7 years ago.
I have to import a MAT-file in a fortran program. I followed the example file but I am facing some problems while linking. The compilation happens fine.
Minimal code:
#include "fintrf.h"
PROGRAM main
USE ssa
USE dmotifs
USE param
IMPLICIT NONE
! MAT-FILE Declarations !
INTEGER matOpen, matGetDir
INTEGER matGetVariableInfo
INTEGER mp, dir, adir(100), pa
INTEGER mxGetM, mxGetN, matClose
INTEGER ndir, i, clstat
CHARACTER*32 names(100)
!===========================!
if(all(fnames(:)%fn .NE. argfun)) then
write(*,*) "No such motif: ",argfun
write(*,*) "Input format-> main <motifname>"
stop
else
fin=fchton(argfun)
y0=nM2m*analys(p,argfun)
! ==> OPEN MAT-file <== !
mp=matOpen('./PRMS_lxr_29Apr15.mat','r')
if (mp .eq. 0) then
write(6,*) "Can't open MAT-file"
stop
end if
dir = matgetdir(mp, ndir)
if (dir .eq. 0) then
write(6,*) "Can't read MAT-file-directory."
stop
endif
call mxCopyPtrToPtrArray(dir, adir, ndir)
do 20 i=1,ndir
call mxCopyPtrToCharacter(adir(i), names(i), 32)
20 continue
write(6,*) 'Directory of Mat-file:'
do 30 i=1,ndir
write(6,*) names(i)
30 continue
write(6,*) 'Getting Header info from first array.'
pa = matGetVariableInfo(mp, names(1))
write(6,*) 'Retrieved ', names(1)
write(6,*) ' With size ', mxGetM(pa), '-by-', mxGetN(pa)
call mxDestroyArray(pa)
clstat=matClose(mp)
end if
END PROGRAM main
I am using gfortran 4.8.3 for compiling+linking using the default command:
gfortran main.f90 dmotifs.o param.o ssa.o -o main
This code compiles fine (without linking) when I do not include: #include "finitrf.h", otherwise the compiler says
Warning: main.f90:1: Illegal preprocessor directive
I tried renaming finitrf.h to finitrf.f90 but it did not make any difference. Nonetheless during linking I am getting these errors:
main.f90:(.text+0x3ea): undefined reference to `matopen_'
main.f90:(.text+0x487): undefined reference to `matgetdir_'
main.f90:(.text+0x52b): undefined reference to `mxcopyptrtoptrarray_'
main.f90:(.text+0x583): undefined reference to `mxcopyptrtocharacter_'
main.f90:(.text+0x71b): undefined reference to `matgetvariableinfo_'
main.f90:(.text+0x804): undefined reference to `mxgetm_'
main.f90:(.text+0x855): undefined reference to `mxgetn_'
main.f90:(.text+0x89c): undefined reference to `mxdestroyarray_'
main.f90:(.text+0x8b0): undefined reference to `matclose_'
collect2: error: ld returned 1 exit status
Do I need a makefile or add additional arguments in the compile command?
EDIT:
I added the -cpp option and that eliminates the problem of Illegal preprocessor directive
Now when I am compiling with paths to matlab external components (where finitf.h) is, I am still getting the same error.
gfortran main.f90 dmotifs.o param.o ssa.o -I/usr/local/matlab2008a/extern/include -L/usr/local/matlab2008a/extern/lib -cpp -o main
If I provide library path to /usr/local/matlab2008a/bin/glnxa64 that contains other matlab libraries including libmat.so, I still get the same errors.
For lower case file extensions *.f90 or *.f the pre-processor is typically deactivated. To enable that, either rename the (main) file to have a capital extension *.F90 or *.F, or provide the corresponding command-line option (-cpp for gfortran, -fpp for ifort).
Assuming the missing subroutines/functions are actually declared in fintrf.h, this should solve your problem.
You should additionally tell the compiler to link against the libraries containing the Matlab functions.
As pointed out by Alexander Vogt, the compiler requires -cpp option for the pre-processor to recognize the header file and not to treat it as illegal.
Linking requires finitrf.h which is usually located in the <matlabroot>/extern/include and the essential libraries are present in <matlabroot>/bin/<arch>/.
But just specifying this does not work and specification of the exact matlab library seems essential; these are libmat.so and libmx.so.
These libraries are in turn dependent on other libraries so another flag is required to set the rpath.
Finally it works with following command:
gfortran main.f90 dmotifs.o param.o ssa.o -I/usr/local/matlab2008a/extern/include -L/usr/local/matlab2008a/bin/glnxa64 -cpp -o main -lmat -lmx -Wl,-rpath /usr/local/matlab2008a/bin/glnxa64/
or in general
gfortran program.f90 -I<matlabroot>/extern/include -L<matlabroot>/bin/<arch> -cpp -lmat -lmx -Wl, -rpath <matlabroot>/bin/<arch> -o program.out
Also see this post that is about the same problem in C.

Arduino HTTPClient not working

I have an Arduino with an Ethernet shield.
I have the httpclient library, and I am trying to run the PachubeClient example.
When I compile, it gives me many errors:
PachubeClient.cpp:25:25: error: Credentials.h: No such file or directory
PachubeClient.cpp: In function 'void setup()':
PachubeClient:47: error: 'ssid' was not declared in this scope
PachubeClient:47: error: 'passphrase' was not declared in this scope
PachubeClient:55: error: a function-definition is not allowed here before '{' token
PachubeClient:95: error: expected `}' at end of input
Why?
I haven't played around with the Arduino development environment at all but that error message means you're either missing the Credentials.h file or the compiler doesn't know where to find it. Verify that the file exists and then check your compiler settings to make sure that you're passing it the path to the header files.