I compile program using openSSL and during compilation I am getting:
error C3861: fips_aes_cbc_encrypt: identifier not found
and functions AES_cbc_encrypt marked with red underline.
What does it mean and how do I fix it?
Related
Currently, I am trying to resolve several issues in a REALLY old c166 16bit microprocessor code. I have basic knowledge with c but not with microprocessors or c166, therefore I have zero clue what the compiler is trying to tell me. Maybe some of you guys know what is going on here / aka help me to resolve this compiler error:
Code
void ChecksummenBerechnenFar(word wAnzahlByte, byte far* bP_AnfangSpeicher)
{
word wChecksum;
word wCount;
for(wChecksum=0xFFFF, wCount=0; wCount < (wAnzahlByte-2); wCount+=1 ) {
wChecksum -= *bP_AnfangSpeicher++;
}
*bP_AnfangSpeicher = (byte) (wChecksum & 0x00FF);
bP_AnfangSpeicher++;
*bP_AnfangSpeicher = (byte) (wChecksum >>8);
}
Error
compiling CHECKS.C...
\CHECKS.C(8): error C25: syntax error near 'wAnzahlByte'
\CHECKS.C(9): warning C35: 'ChecksummenBerechnenFar': uses old-style declarator
\CHECKS.C(10): error C25: syntax error near 'wChecksum'
\CHECKS.C(10): warning C34: 'wChecksum': missing declaration specifiers
\CHECKS.C(11): warning C34: 'wCount': missing declaration specifiers
\CHECKS.C(11): error C42: 'wCount': not in formal parameter list
\CHECKS.C(12): error C25: syntax error near 'for'
\CHECKS.C(12): error C25: syntax error near '='
\CHECKS.C(12): error C25: syntax error near '<'
\CHECKS.C(12): error C25: syntax error near '-'
\CHECKS.C(12): error C25: syntax error near '+='
\CHECKS.C(13): error C25: syntax error near '-='
\CHECKS.C(13): error C25: syntax error near '++'
\CHECKS.C(16): error C67: 'byte': undefined identifier
\CHECKS.C(17): error C25: syntax error near '++'
\CHECKS.C(18): error C53: redefinition of 'bP_AnfangSpeicher'
\CHECKS.C(18): error C67: 'byte': undefined identifier
\CHECKS.C(20): error C25: syntax error near '}'
\CHECKS.C(20): error C7: compilation aborted
You seem to be missing a header file inclusion. Some data type might have been renamed using typedef somewhere.
If you are on a Linux host, I recommend installing "ctags" to browse through your code to find definitions and declarations.
For now you could do a grep in your source code directory
"find -name *.h | grep -rn typedef | grep word"
This will give you a file name and line number. open the file location and go to the line number check if that's the definition you are looking for.
If yes then include that file.
Commenters have mentioned that word and byte are not standard C and that’s true. But you aren’t seeing “undeclared identifier” errors.
I think that somehow the symbols word and byte have been #defined as empty strings. Maybe the #defines try to choose appropriate definitions based on the architecture you’re compiling for, and since you’re on a new architecture that it doesn’t recognize, they get converted into blank strings. You might be expected to pass in some kind of value via the -D switch that identifies the target architecture, especially if it’s different from the one you’re compiling on.
With the types replaced by empty strings, the compiler thinks you’re using the ancient K&R function definition syntax, and that’s why you’re seeing these errors.
Try compiling with -E to dump the preprocessor output and see what you get.
Trying to build apr 1.7 on Windows with Visual Studio, tried 2017 and 2013.
When building the project (Debug|x86) or compiling e.g. dso.c if get the following error message:
1>dso.c
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): error C2143: syntax error: missing ')' before '*'
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): error C2143: syntax error: missing '{' before '*'
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): error C2059: syntax error: ')'
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): error C2061: syntax error: identifier 'apr_winapi_pfn_if_indextoname'
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): error C2059: syntax error: ';'
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): error C2513: ' ': no variable declared before '='
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): error C2065: 'apr_winapi_pfn_if_indextoname': undeclared identifier
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): warning C4047: '=': 'int' differs in levels of indirection from 'int *(__cdecl *)(NET_IFINDEX,PCHAR)'
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): error C2146: syntax error: missing ';' before identifier 'apr_load_dll_func'
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): error C2100: illegal indirection
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): error C2064: term does not evaluate to a function taking 1207 arguments
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): warning C4033: 'apr_winapi_if_indextoname' must return a value
I have succesfully build version 1.65 (after apply the hint from http://letcoderock.blogspot.com/2017/09/build-log4cxx-trunk-on-windows-by.html or Apache Cross Compilation Error ./gen_test_char: cannot execute binary file)
Comparing apr_arch_misc.h of the two version, i have noticed DLL_IPHLPAPI was new to the enum apr_dlltoken_e and Intelisense was complaining about
APR_DECLARE_LATE_DLL_FUNC(DLL_IPHLPAPI, PCHAR, NETIOAPI_API_, if_indextoname, 0, (
NET_IFINDEX InterfaceIndex,
PCHAR InterfaceName),
(InterfaceIndex, InterfaceName));
with "expecting a ')'".
If have changed NETIOAPI_API_ to WINAPI. Do not know if this is correct but the file could now be compiled (after running the above trick with gen_test_char.exe).
But after that I ran into the next Problem:
1>sockaddr.c
1>network_io\unix\sockaddr.c(144): error C2065: 'IF_NAMESIZE': undeclared identifier
1>network_io\unix\sockaddr.c(144): error C2057: expected constant expression
1>network_io\unix\sockaddr.c(144): error C2466: cannot allocate an array of constant size 0
1>network_io\unix\sockaddr.c(144): error C2133: 'scbuf': unknown size
1>network_io\unix\sockaddr.c(1274): error C2065: 'IF_NAMESIZE': undeclared identifier
I have succesfully build apr with gcc in linux/cygwin. I have looked into the the preprocessor substitutions for IF_NAMESIZE and here it is replaced by 44. But I can not find the definiton or where this is set.
Does anyone have an idea how to fix this? And is the above change to WINAPI correct?
Just use cmake to build the Visual Studio Solution:
With
cmake -G "Visual Studio 15 2017" -A x64
the .sln ist properly set up and building the solution works with no errors. Even gen_test_char.exe is build.
Maybe the apr project should make the cmake building instructions a little bit more prominent on their site.
As written in README file:
Note you must manually modify the include\apr.hw file before you
build to change default options
So i just removed line #define _WIN32_WINNT 0x0501 from apr-1.7.0\include\apr.hw
and run nmake -f Makefile.win. Worked fine for me. VS2017 tools, Windows 10.
In case someone else also runs into this problem: I was using cmake + nmake to build APR, but it still didn't work for me.
The reason was that I had old compilation flags to support Windows XP:
cmake -DMIN_WINDOWS_VER=0x0501 ...
Investigating Iphlpapi.h, it seems that netioapi.h and other networking headers used by the current version of APR are supported only starting from Vista onward:
#if (NTDDI_VERSION >= NTDDI_VISTA)
#include <netioapi.h>
#endif // (NTDDI_VERSION >= NTDDI_VISTA)
So in order for the compilation to work, just remove that cmake option or specify a value higher than 0x0600 (the equivalent for Vista).
how to solve pgcc&openacc linker error "__pgi_uacc_multicorestart", "__pgi_uacc_multicoreend"
This is a follow up question after the one above.
In "compile lbe.c to lbe.o message:", I always see the "PGC-I-0222-Redundant definition" message. Is it a warning or error? Why would it happen? How do I fix it?
PGC-I-0222-Redundant definition for symbol __THROW (/usr/include/x86_64-linux-gnu/sys/cdefs.h: 74)
PGC-I-0222-Redundant definition for symbol __extension__ (/usr/include/x86_64-linux-gnu/sys/cdefs.h: 358)
There are just information messages indicating that the symbols are getting defined twice. Since it's the same definition for both, it's fine and no need to fix.
I'm trying to include Csparse from SuiteSparse in to Simulink.
I've included the header ch.h and the directory of the c-functions in the custom code section.
If I call the function cs_compress over code.ceval I get this error:
cs_compress.obj : error LNK2019: unresolved external symbol cs_spalloc referenced in function cs_compress
Test2_sfun.mexw64 : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\link.exe"' : return code '0x460'
Stop.
The function cs_spalloc I presume is called from a library since there exists no cs_spalloc.c. The function is however defined in the header file as:
cs *cs_spalloc (csi m, csi n, csi nzmax, csi values, csi triplet) ;
Am I right to presume it is called from a library?
And if so where do I find the library in a format to include in to the custom code section in Simulink?
I found the c- functions cs_spalloc online, and just copyed it. Now it works.
--------------------Configuration: AllTests - Win32 Debug--------------------
Linking...
AllTests.obj : error LNK2001: unresolved external symbol "int externTestGroupMockDocumentation" (?externTestGroupMockDocumentation##3HA)
AllTests.obj : error LNK2001: unresolved external symbol "int externTestGroupEventDispatcher" (?externTestGroupEventDispatcher##3HA)
Debug/AllTests.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
AllTests.exe - 3 error(s), 0 warning(s)
Why do I get these errors and how can I resolve them?
Do you have these lines in your AllTests.cpp?
IMPORT_TEST_GROUP(MockDocumentation)
IMPORT_TEST_GROUP(EventDispatcher)
If you do, you also need to have these test groups defined in you build:
TEST_GROUP(MockDocumentation)
TEST_GROUP(EventDispatcher)
James
wondering if you got over this issue,
I am facing the same issue although I have
IMPORT_TEST_GROUP(my_test_group);
in AllTests.cpp and properly defining
TEST_GROUP(my_test_group) {};
in my_test.cpp as per Mr. Grenning's advice.
Notice I have been able to get it to compile by applying either one of the following workarounds:
1- Add the cpp file containing the function definition to the UnitTest project. Or..
2- Have the function definition in the header file (typical if your function is a template)
I don't know if either/any of the suggestions is correct (so not claiming an answer yet), however, I mention my workaround here in the hope others might find it helpful.
N.B. I have CppUTest-3.6 configured with visual studio 2010 according to "D:\cpputest-3.6\docsWalkThrough_VS21010.docx"
Hasan