- Index
- » Programming & Scripting
- » [SOLVED] «unknown type name ‘FILE'» inside of GNU Readline
Pages: 1
#1 2020-03-18 02:28:51
- bwbuhse
- Member
- Registered: 2020-03-18
- Posts: 6
[SOLVED] «unknown type name ‘FILE'» inside of GNU Readline
I just switched to Arch today and am trying to make sure I have everything configured fairly well.
One thing I’m trying to do is ensure that I can compile my old projects, but I’ve run into the issue in this ( https://github.com/bwbuhse/ee461s_project_1 ) project that readline doesn’t include <stdio.h>
Any ideas on what I’m doing wrong? This compiled fine on my old Mint installation.
Last edited by bwbuhse (2020-03-18 14:51:10)
#2 2020-03-18 02:32:33
- bwbuhse
- Member
- Registered: 2020-03-18
- Posts: 6
Re: [SOLVED] «unknown type name ‘FILE'» inside of GNU Readline
https://pastebin.com/eL3KxSB9 here’s a link to a pastebin of the full output when I try to compile
#3 2020-03-18 05:33:24
- ayekat
- Member
- Registered: 2011-01-17
- Posts: 1,553
- Website
Re: [SOLVED] «unknown type name ‘FILE'» inside of GNU Readline
To compile with readline, you’ll need additional flags. Use pkgconf for determining the required compilation flags, i.e.:
pkgconf --cflags readline
—edit: Same for the linking step. `-lreadline` is correct, but I wouldn’t hardcode it, but also use the output of `pkgconf —libs` there.
Last edited by ayekat (2020-03-18 05:34:43)
{,META,RE}PKGBUILDS │ pacman-hacks (includes makemetapkg and remakepkg) │ dotfileslocaldir
#4 2020-03-18 11:51:24
- Trilby
- Inspector Parrot
- Registered: 2011-11-29
- Posts: 27,833
- Website
Re: [SOLVED] «unknown type name ‘FILE'» inside of GNU Readline
Ayekat, that doesn’t help. The OP’s concern is that readline itself uses FILE but does not include the header in which it is defined. This does seem wrong to me — though readline’s man page shows that one must include stdio.h themselves to use readline: so it is documented.
But bwbuhse, you also use printf in your code, so you definitely need to include stdio.h. I can only assume that what ever distro/compiler you previously used just included common things for you.
«UNIX is simple and coherent…» — Dennis Ritchie, «GNU’s Not UNIX» — Richard Stallman
#5 2020-03-18 14:50:53
- bwbuhse
- Member
- Registered: 2020-03-18
- Posts: 6
Re: [SOLVED] «unknown type name ‘FILE'» inside of GNU Readline
Would you look at that, Trilby, you’re right. I’d tried including it before but I guess I needed to include it above where I included readline. Thanks!
#6 2020-03-18 15:08:38
- ayekat
- Member
- Registered: 2011-01-17
- Posts: 1,553
- Website
Re: [SOLVED] «unknown type name ‘FILE'» inside of GNU Readline
Ah yes, I should’ve tested it myself, sorry for the noise.
I had assumed that the additional `-D_…` parameters would cause the readline header to include the right headers (or rather define the right macros) to eventually get all the required definitions, but… nope.
It’s indeed weird that including the required header files is left to the programmer… but I guess if it’s documented, one cannot really complain too much :-/
{,META,RE}PKGBUILDS │ pacman-hacks (includes makemetapkg and remakepkg) │ dotfileslocaldir
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
// make sure to link to the libraries libd3d9.a and libd3dx9_43.a. // - copy the two files from the lib directory of your compiler // - open project options >> parameters and add both using "Add Library or Object" #include <windows.h> #include <windowsx.h> #include <d3d9.h> #include <d3dx9.h> // Defines struct CUSTOMVERTEX { float X; float Y; float Z; DWORD COLOR; }; #define CUSTOMFVF (D3DFVF_XYZ | D3DFVF_DIFFUSE) // global declarations LPDIRECT3D9 d3d; // the pointer to our Direct3D interface LPDIRECT3DDEVICE9 d3ddev; // the pointer to the device class LPDIRECT3DVERTEXBUFFER9 vertexbuffer = NULL; // the pointer to the vertex buffer // this is the function that puts the 3D models into video RAM void init_graphics() { // create the vertices using the CUSTOMVERTEX struct CUSTOMVERTEX vertices[] = { { 3.0f, -3.0f, 0.0f, D3DCOLOR_XRGB(0, 0, 255)}, { 0.0f, 3.0f, 0.0f, D3DCOLOR_XRGB(0, 255, 0)}, {-3.0f, -3.0f, 0.0f, D3DCOLOR_XRGB(255, 0, 0)}, }; // create a vertex buffer interface called v_buffer d3ddev->CreateVertexBuffer(3 * sizeof(CUSTOMVERTEX), 0, CUSTOMFVF, D3DPOOL_MANAGED, &vertexbuffer, NULL); VOID* pVoid; // lock v_buffer and load the vertices into it vertexbuffer->Lock(0, 0, (void**)&pVoid, 0); memcpy(pVoid, vertices, sizeof(vertices)); vertexbuffer->Unlock(); } // this function initializes and prepares Direct3D for use void initD3D(HWND hwnd) { d3d = Direct3DCreate9(D3D_SDK_VERSION); D3DPRESENT_PARAMETERS d3dpp; ZeroMemory(&d3dpp, sizeof(d3dpp)); d3dpp.Windowed = true; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.hDeviceWindow = hwnd; d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8; d3dpp.BackBufferWidth = 800; d3dpp.BackBufferHeight = 600; d3dpp.EnableAutoDepthStencil = true; // Manage SetDepthStencil for us d3dpp.AutoDepthStencilFormat = D3DFMT_D16; // 16-bit pixel format for the z-buffer // create a device class using this information and the info from the d3dpp stuct d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &d3ddev); // Create resources init_graphics(); d3ddev->SetRenderState(D3DRS_LIGHTING, false); // turn off the 3D lighting d3ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); // both sides of the triangles d3ddev->SetRenderState(D3DRS_ZENABLE, true); // turn on the z-buffer } // this is the function used to render a single frame void render_frame() { d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); d3ddev->Clear(0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); d3ddev->BeginScene(); // select which vertex format we are using d3ddev->SetFVF(CUSTOMFVF); // set the view transform D3DXMATRIX matView; // the view transform matrix D3DXVECTOR3 camPos(0.0f, 0.0f, 15.0f); D3DXVECTOR3 lookAt(0.0f, 0.0f, 0.0f); D3DXVECTOR3 up(0.0f, 1.0f, 0.0f); D3DXMatrixLookAtLH(&matView, &camPos, // the camera position &lookAt, // the look-at position &up); // the up direction d3ddev->SetTransform(D3DTS_VIEW, &matView); // set the projection transform D3DXMATRIX matProjection; // the projection transform matrix D3DXMatrixPerspectiveFovLH(&matProjection, D3DXToRadian(45), // the vertical field of view 800.0f/600.0f, // aspect ratio 1.0f, // the near view-plane 100.0f); // the far view-plane d3ddev->SetTransform(D3DTS_PROJECTION, &matProjection); // select the vertex buffer to display d3ddev->SetStreamSource(0, vertexbuffer, 0, sizeof(CUSTOMVERTEX)); D3DXMATRIX matTranslateA; // a matrix to store the translation for triangle A D3DXMATRIX matTranslateB; // a matrix to store the translation for triangle B D3DXMATRIX matRotateY; // a matrix to store the rotation for each triangle static float index = 0.0f; index+=0.05f; // an ever-increasing float value // build MULTIPLE matrices to translate the model and one to rotate D3DXMatrixTranslation(&matTranslateA, 0.0f, 0.0f, 2.0f); D3DXMatrixTranslation(&matTranslateB, 0.0f, 0.0f, -2.0f); D3DXMatrixRotationY(&matRotateY, index); // the front side // tell Direct3D about each world transform, and then draw another triangle D3DMATRIX matTemp(matTranslateA * matRotateY); d3ddev->SetTransform(D3DTS_WORLD, &matTemp); d3ddev->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1); matTemp = matTranslateB * matRotateY; d3ddev->SetTransform(D3DTS_WORLD, &matTemp); d3ddev->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1); d3ddev->EndScene(); d3ddev->Present(NULL, NULL, NULL, NULL); } // this is the function that cleans up Direct3D and COM void cleanD3D() { vertexbuffer->Release(); // close and release the vertex buffer d3ddev->Release(); // close and release the 3D device d3d->Release(); // close and release Direct3D } // this is the main message handler for the program LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_DESTROY: { PostQuitMessage(0); break; } default: return DefWindowProc (hWnd, message, wParam, lParam); } } // the entry point for any Windows program int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { HWND hwnd; WNDCLASSEX wc; MSG msg; memset(&wc,0,sizeof(wc)); wc.cbSize = sizeof(WNDCLASSEX); wc.lpfnWndProc = WindowProc; wc.hInstance = hInstance; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW); wc.lpszClassName = "WindowClass"; wc.hIcon = NULL; wc.hIconSm = NULL; RegisterClassEx(&wc); hwnd = CreateWindowEx(0, "WindowClass", "Direct3D FFP Example", WS_OVERLAPPEDWINDOW, 0, 0, 800, 600, NULL, NULL, hInstance, NULL); ShowWindow(hwnd, SW_SHOW); // set up and initialize Direct3D initD3D(hwnd); // enter the main loop while(msg.message != WM_QUIT) { while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } render_frame(); } // clean up DirectX and COM cleanD3D(); return msg.wParam; } |
libtool: link: echo «local: *; };» >> .libs/libtimecode_plugin.ver
libtool: link: x86_64-pc-linux-gnu-gcc -std=gnu99 -shared -fPIC -DPIC access/.libs/timecode.o -Wl,-rpath -Wl,/var/tmp/portage/media-video/vlc-2.2.1-r1/work/vlc-2.2.1/src/.libs ../compat/.libs/libcompat.a -L/usr/lib64/sidplay/builders/ ../src/.libs/libvlccore.so -lrt -lidn -lpthread -ldl -lm -ldbus-1 -Wl,—as-needed -march=core2 -O2 -Wl,-O1 -Wl,-soname -Wl,libtimecode_plugin.so -Wl,-version-script -Wl,.libs/libtimecode_plugin.ver -o .libs/libtimecode_plugin.so
libtool: link: ( cd «.libs» && rm -f «libtimecode_plugin.la» && ln -s «../libtimecode_plugin.la» «libtimecode_plugin.la» )
../doltlibtool —tag=CC —mode=compile x86_64-pc-linux-gnu-gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -DMODULE_STRING=»$(p=»access/zip/libzip_plugin_la-zipstream.lo»; p=»${p##*/}»; p=»${p#lib}»; p=»${p%_plugin*}»; p=»${p%.lo}»; echo «$p»)» -D__PLUGIN__ -I./access -I./codec -I../include -I../include -I/usr/include/minizip -march=core2 -O2 -pipe -Wall -Wextra -Wsign-compare -Wundef -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wmissing-prototypes -Wvolatile-register-var -Werror-implicit-function-declaration -pipe -fvisibility=hidden -c -o access/zip/libzip_plugin_la-zipstream.lo `test -f ‘access/zip/zipstream.c’ || echo ‘./’`access/zip/zipstream.c
In file included from /usr/include/minizip/unzip.h:55:0,
from access/zip/zip.h:37,
from access/zip/zipstream.c:32:
/usr/include/minizip/ioapi.h:135:51: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
typedef voidpf (ZCALLBACK *open_file_func) _Z_OF((voidpf opaque, const char* filename, int mode));
^
/usr/include/minizip/ioapi.h:136:51: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
typedef uLong (ZCALLBACK *read_file_func) _Z_OF((voidpf opaque, voidpf stream, void* buf, uLong size));
^
/usr/include/minizip/ioapi.h:137:51: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
typedef uLong (ZCALLBACK *write_file_func) _Z_OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
^
/usr/include/minizip/ioapi.h:138:51: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
typedef int (ZCALLBACK *close_file_func) _Z_OF((voidpf opaque, voidpf stream));
^
/usr/include/minizip/ioapi.h:139:51: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
typedef int (ZCALLBACK *testerror_file_func) _Z_OF((voidpf opaque, voidpf stream));
^
/usr/include/minizip/ioapi.h:141:51: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
typedef long (ZCALLBACK *tell_file_func) _Z_OF((voidpf opaque, voidpf stream));
^
/usr/include/minizip/ioapi.h:142:51: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
typedef long (ZCALLBACK *seek_file_func) _Z_OF((voidpf opaque, voidpf stream, uLong offset, int origin));
^
/usr/include/minizip/ioapi.h:148:5: error: unknown type name ‘open_file_func’
open_file_func zopen_file;
^
/usr/include/minizip/ioapi.h:149:5: error: unknown type name ‘read_file_func’
read_file_func zread_file;
^
/usr/include/minizip/ioapi.h:150:5: error: unknown type name ‘write_file_func’
write_file_func zwrite_file;
^
/usr/include/minizip/ioapi.h:151:5: error: unknown type name ‘tell_file_func’
tell_file_func ztell_file;
^
/usr/include/minizip/ioapi.h:152:5: error: unknown type name ‘seek_file_func’
seek_file_func zseek_file;
^
/usr/include/minizip/ioapi.h:153:5: error: unknown type name ‘close_file_func’
close_file_func zclose_file;
^
/usr/include/minizip/ioapi.h:154:5: error: unknown type name ‘testerror_file_func’
testerror_file_func zerror_file;
^
/usr/include/minizip/ioapi.h:158:51: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
typedef ZPOS64_T (ZCALLBACK *tell64_file_func) _Z_OF((voidpf opaque, voidpf stream));
^
/usr/include/minizip/ioapi.h:159:51: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
typedef long (ZCALLBACK *seek64_file_func) _Z_OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
^
/usr/include/minizip/ioapi.h:160:51: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
typedef voidpf (ZCALLBACK *open64_file_func) _Z_OF((voidpf opaque, const void* filename, int mode));
^
/usr/include/minizip/ioapi.h:164:5: error: unknown type name ‘open64_file_func’
open64_file_func zopen64_file;
^
/usr/include/minizip/ioapi.h:165:5: error: unknown type name ‘read_file_func’
read_file_func zread_file;
^
/usr/include/minizip/ioapi.h:166:5: error: unknown type name ‘write_file_func’
write_file_func zwrite_file;
^
/usr/include/minizip/ioapi.h:167:5: error: unknown type name ‘tell64_file_func’
tell64_file_func ztell64_file;
^
/usr/include/minizip/ioapi.h:168:5: error: unknown type name ‘seek64_file_func’
seek64_file_func zseek64_file;
^
/usr/include/minizip/ioapi.h:169:5: error: unknown type name ‘close_file_func’
close_file_func zclose_file;
^
/usr/include/minizip/ioapi.h:170:5: error: unknown type name ‘testerror_file_func’
testerror_file_func zerror_file;
^
/usr/include/minizip/ioapi.h:174:28: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
void fill_fopen64_filefunc _Z_OF((zlib_filefunc64_def* pzlib_filefunc_def));
^
/usr/include/minizip/ioapi.h:175:26: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
void fill_fopen_filefunc _Z_OF((zlib_filefunc_def* pzlib_filefunc_def));
^
/usr/include/minizip/ioapi.h:181:5: error: unknown type name ‘open_file_func’
open_file_func zopen32_file;
^
/usr/include/minizip/ioapi.h:182:5: error: unknown type name ‘tell_file_func’
tell_file_func ztell32_file;
^
/usr/include/minizip/ioapi.h:183:5: error: unknown type name ‘seek_file_func’
seek_file_func zseek32_file;
^
/usr/include/minizip/ioapi.h:194:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
voidpf call_zopen64 _Z_OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode));
^
/usr/include/minizip/ioapi.h:195:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
long call_zseek64 _Z_OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin));
^
/usr/include/minizip/ioapi.h:196:23: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
ZPOS64_T call_ztell64 _Z_OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream));
^
In file included from access/zip/zip.h:37:0,
from access/zip/zipstream.c:32:
/usr/include/minizip/unzip.h:153:45: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern int ZEXPORT unzStringFileNameCompare _Z_OF ((const char* fileName1,
^
/usr/include/minizip/unzip.h:166:32: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern unzFile ZEXPORT unzOpen _Z_OF((const char *path));
^
/usr/include/minizip/unzip.h:167:34: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern unzFile ZEXPORT unzOpen64 _Z_OF((const void *path));
^
/usr/include/minizip/unzip.h:184:33: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern unzFile ZEXPORT unzOpen2 _Z_OF((const char *path,
^
/usr/include/minizip/unzip.h:191:36: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern unzFile ZEXPORT unzOpen2_64 _Z_OF((const void *path,
^
/usr/include/minizip/unzip.h:198:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern int ZEXPORT unzClose _Z_OF((unzFile file));
^
/usr/include/minizip/unzip.h:205:37: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern int ZEXPORT unzGetGlobalInfo _Z_OF((unzFile file,
^
/usr/include/minizip/unzip.h:208:39: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern int ZEXPORT unzGetGlobalInfo64 _Z_OF((unzFile file,
^
/usr/include/minizip/unzip.h:216:40: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern int ZEXPORT unzGetGlobalComment _Z_OF((unzFile file,
^
/usr/include/minizip/unzip.h:229:37: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern int ZEXPORT unzGoToFirstFile _Z_OF((unzFile file));
^
/usr/include/minizip/unzip.h:235:36: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern int ZEXPORT unzGoToNextFile _Z_OF((unzFile file));
^
/usr/include/minizip/unzip.h:242:34: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern int ZEXPORT unzLocateFile _Z_OF((unzFile file,
^
/usr/include/minizip/unzip.h:288:44: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern int ZEXPORT unzGetCurrentFileInfo64 _Z_OF((unzFile file,
^
/usr/include/minizip/unzip.h:297:42: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern int ZEXPORT unzGetCurrentFileInfo _Z_OF((unzFile file,
^
/usr/include/minizip/unzip.h:321:55: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 _Z_OF((unzFile file));
^
/usr/include/minizip/unzip.h:331:39: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern int ZEXPORT unzOpenCurrentFile _Z_OF((unzFile file));
^
/usr/include/minizip/unzip.h:337:47: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern int ZEXPORT unzOpenCurrentFilePassword _Z_OF((unzFile file,
^
/usr/include/minizip/unzip.h:345:40: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern int ZEXPORT unzOpenCurrentFile2 _Z_OF((unzFile file,
^
/usr/include/minizip/unzip.h:358:40: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern int ZEXPORT unzOpenCurrentFile3 _Z_OF((unzFile file,
^
/usr/include/minizip/unzip.h:373:40: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern int ZEXPORT unzCloseCurrentFile _Z_OF((unzFile file));
^
/usr/include/minizip/unzip.h:379:39: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern int ZEXPORT unzReadCurrentFile _Z_OF((unzFile file,
^
/usr/include/minizip/unzip.h:393:32: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern z_off_t ZEXPORT unztell _Z_OF((unzFile file));
^
/usr/include/minizip/unzip.h:395:35: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern ZPOS64_T ZEXPORT unztell64 _Z_OF((unzFile file));
^
/usr/include/minizip/unzip.h:400:27: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern int ZEXPORT unzeof _Z_OF((unzFile file));
^
/usr/include/minizip/unzip.h:405:42: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_Z_OF’
extern int ZEXPORT unzGetLocalExtrafield _Z_OF((unzFile file,
^
access/zip/zipstream.c: In function ‘StreamOpen’:
access/zip/zipstream.c:193:40: warning: assignment makes integer from pointer without a cast
p_sys->fileFunctions->zopen_file = ZipIO_Open;
^
access/zip/zipstream.c:194:40: warning: assignment makes integer from pointer without a cast
p_sys->fileFunctions->zread_file = ZipIO_Read;
^
access/zip/zipstream.c:195:40: warning: assignment makes integer from pointer without a cast
p_sys->fileFunctions->zwrite_file = ZipIO_Write;
^
access/zip/zipstream.c:196:40: warning: assignment makes integer from pointer without a cast
p_sys->fileFunctions->ztell_file = ZipIO_Tell;
^
access/zip/zipstream.c:197:40: warning: assignment makes integer from pointer without a cast
p_sys->fileFunctions->zseek_file = ZipIO_Seek;
^
access/zip/zipstream.c:198:40: warning: assignment makes integer from pointer without a cast
p_sys->fileFunctions->zclose_file = ZipIO_Close;
^
access/zip/zipstream.c:199:40: warning: assignment makes integer from pointer without a cast
p_sys->fileFunctions->zerror_file = ZipIO_Error;
^
access/zip/zipstream.c:201:5: error: implicit declaration of function ‘unzOpen2’ [-Werror=implicit-function-declaration]
p_sys->zipFile = unzOpen2( NULL /* path */, p_sys->fileFunctions );
^
access/zip/zipstream.c:201:20: warning: assignment makes pointer from integer without a cast
p_sys->zipFile = unzOpen2( NULL /* path */, p_sys->fileFunctions );
^
access/zip/zipstream.c: In function ‘StreamClose’:
access/zip/zipstream.c:233:9: error: implicit declaration of function ‘unzClose’ [-Werror=implicit-function-declaration]
unzClose( p_sys->zipFile );
^
access/zip/zipstream.c: In function ‘GetFilesInZip’:
access/zip/zipstream.c:412:5: error: implicit declaration of function ‘unzGetGlobalInfo’ [-Werror=implicit-function-declaration]
if( unzGetGlobalInfo( file, &info ) != UNZ_OK )
^
access/zip/zipstream.c:419:5: error: implicit declaration of function ‘unzGoToFirstFile’ [-Werror=implicit-function-declaration]
unzGoToFirstFile( file );
^
access/zip/zipstream.c:434:9: error: implicit declaration of function ‘unzGetCurrentFileInfo’ [-Werror=implicit-function-declaration]
if( unzGetCurrentFileInfo( file, p_fileInfo, psz_fileName,
^
access/zip/zipstream.c:456:13: error: implicit declaration of function ‘unzGoToNextFile’ [-Werror=implicit-function-declaration]
if( unzGoToNextFile( file ) != UNZ_OK )
^
access/zip/zipstream.c: In function ‘ZipIO_Write’:
access/zip/zipstream.c:846:9: warning: unused variable ‘ERROR_zip_cannot_write_this_should_not_happen’ [-Wunused-variable]
int ERROR_zip_cannot_write_this_should_not_happen = 0;
^
cc1: some warnings being treated as errors
Makefile:9133: recipe for target ‘access/zip/libzip_plugin_la-zipstream.lo’ failed
make[4]: *** [access/zip/libzip_plugin_la-zipstream.lo] Error 1
make[4]: *** Waiting for unfinished jobs….
libtool: link: /usr/bin/x86_64-pc-linux-gnu-nm -B access/.libs/vdr.o | sed -n -e ‘s/^.*[ ]([ABCDGIRSTW][ABCDGIRSTW]*)[ ][ ]*([_A-Za-z][_A-Za-z0-9]*)$/1 2 2/p’ | sed ‘/ __gnu_lto/d’ | /bin/sed ‘s/.* //’ | sort | uniq > .libs/libvdr_plugin.exp
libtool: link: /bin/grep -E -e «^vlc_entry» «.libs/libvdr_plugin.exp» > «.libs/libvdr_plugin.expT»
libtool: link: mv -f «.libs/libvdr_plugin.expT» «.libs/libvdr_plugin.exp»
libtool: link: echo «{ global:» > .libs/libvdr_plugin.ver
libtool: link: cat .libs/libvdr_plugin.exp | sed -e «s/(.*)/1;/» >> .libs/libvdr_plugin.ver
libtool: link: echo «local: *; };» >> .libs/libvdr_plugin.ver
libtool: link: x86_64-pc-linux-gnu-gcc -std=gnu99 -shared -fPIC -DPIC access/.libs/vdr.o -Wl,-rpath -Wl,/var/tmp/portage/media-video/vlc-2.2.1-r1/work/vlc-2.2.1/src/.libs ../compat/.libs/libcompat.a -L/usr/lib64/sidplay/builders/ ../src/.libs/libvlccore.so -lrt -lidn -lpthread -ldl -lm -ldbus-1 -Wl,—as-needed -march=core2 -O2 -Wl,-O1 -Wl,-soname -Wl,libvdr_plugin.so -Wl,-version-script -Wl,.libs/libvdr_plugin.ver -o .libs/libvdr_plugin.so
libtool: link: ( cd «.libs» && rm -f «libvdr_plugin.la» && ln -s «../libvdr_plugin.la» «libvdr_plugin.la» )
make[4]: Leaving directory ‘/var/tmp/portage/media-video/vlc-2.2.1-r1/work/vlc-2.2.1/modules’
Makefile:9653: recipe for target ‘all-recursive’ failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory ‘/var/tmp/portage/media-video/vlc-2.2.1-r1/work/vlc-2.2.1/modules’
Makefile:4527: recipe for target ‘all’ failed
make[2]: *** [all] Error 2
make[2]: Leaving directory ‘/var/tmp/portage/media-video/vlc-2.2.1-r1/work/vlc-2.2.1/modules’
Makefile:2262: recipe for target ‘all-recursive’ failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory ‘/var/tmp/portage/media-video/vlc-2.2.1-r1/work/vlc-2.2.1’
Makefile:2147: recipe for target ‘all’ failed
make: *** [all] Error 2
* ERROR: media-video/vlc-2.2.1-r1::gentoo failed (compile phase):
* emake failed
*
* If you need support, post the output of `emerge —info ‘=media-video/vlc-2.2.1-r1::gentoo’`,
* the complete build log and the output of `emerge -pqv ‘=media-video/vlc-2.2.1-r1::gentoo’`.
* The complete build log is located at ‘/var/tmp/portage/media-video/vlc-2.2.1-r1/temp/build.log’.
* The ebuild environment file is located at ‘/var/tmp/portage/media-video/vlc-2.2.1-r1/temp/environment’.
* Working directory: ‘/var/tmp/portage/media-video/vlc-2.2.1-r1/work/vlc-2.2.1’
* S: ‘/var/tmp/portage/media-video/vlc-2.2.1-r1/work/vlc-2.2.1’
>>> Failed to emerge media-video/vlc-2.2.1-r1, Log file:
Hello Community, I have a RPI that is reading sensorvalues from another board by I2C. Now I want to send the data to the scope. I searched around the forum, and found an entry where somebody wanted to achieve the same. He used the following code:
function y = fcn()
persistent pf;
pf = coder.opaque(‘FILE *’);
y = coder.nullcopy(uint8(0));
res = coder.nullcopy(uint8(zeros(1, 10)));
readOnly = c_string(‘r’);
readCmd = c_string([‘i2cget -y 0 0x06 49’]);
if isequal(coder.target, ‘rtw’)
pf = coder.ceval(‘popen’, coder.rref(readCmd), coder.rref(readOnly));
coder.ceval(‘fgets’, coder.wref(res), 10, pf);
coder.ceval(‘printf’, c_string(‘%s’), c_string(res));
end
end
function str = c_string(str)
str = [str, 0];
end
I get the following error, when using it:
The call to realtime_make_rtw_hook, during the after_make hook generated the following error:
Error executing SSH command: make: Entering directory `/home/pi/rpi_i2c_fcn_rtt’
«gcc» -I«./» -O3 -D«MODEL=rpi_i2c_fcn» -D«NUMST=1» -D«NCSTATES=0» -D«HAVESTDIO=» -D«ON_TARGET_WAIT_FOR_START=1» -D«ONESTEPFCN=0» -D«EXT_MODE=1» -D«TERMFCN=1» -D«MAT_FILE=0» -D«MULTI_INSTANCE_CODE=0» -D«INTEGER_CODE=0» -D«MT=0» -D«CLASSIC_INTERFACE=0» -D«TID01EQ=0» -D«_USE_TARGET_UDP_=» -D«_RUNONTARGETHARDWARE_BUILD_=» -c ./linuxUDP.c ./ext_svr.c ./ext_work.c ./rtiostream_interface.c ./updown.c ./rtiostream_tcpip.c ./rtiostream_utils.c ./ert_main.c ./rpi_i2c_fcn.c
./rpi_i2c_fcn.c: In function ‘rpi_i2c_fcn_output’:
./rpi_i2c_fcn.c:11:1: error: unknown type name ‘FILE’
./rpi_i2c_fcn.c:11:16: warning: assignment makes pointer from integer without a cast [enabled by default]
make: make: Leaving directory `/home/pi/rpi_i2c_fcn_rtt’
*** [linuxUDP.o] Error 1
The build process will terminate as a result.
Caused by:
Error executing SSH command: make: Entering directory `/home/pi/rpi_i2c_fcn_rtt’
«gcc» -I«./» -O3 -D«MODEL=rpi_i2c_fcn» -D«NUMST=1» -D«NCSTATES=0» -D«HAVESTDIO=» -D«ON_TARGET_WAIT_FOR_START=1» -D«ONESTEPFCN=0» -D«EXT_MODE=1» -D«TERMFCN=1» -D«MAT_FILE=0» -D«MULTI_INSTANCE_CODE=0» -D«INTEGER_CODE=0» -D«MT=0» -D«CLASSIC_INTERFACE=0» -D«TID01EQ=0» -D«_USE_TARGET_UDP_=» -D«_RUNONTARGETHARDWARE_BUILD_=» -c ./linuxUDP.c ./ext_svr.c ./ext_work.c ./rtiostream_interface.c ./updown.c ./rtiostream_tcpip.c ./rtiostream_utils.c ./ert_main.c ./rpi_i2c_fcn.c
./rpi_i2c_fcn.c: In function ‘rpi_i2c_fcn_output’:
./rpi_i2c_fcn.c:11:1: error: unknown type name ‘FILE’
./rpi_i2c_fcn.c:11:16: warning: assignment makes pointer from integer without a cast [enabled by default]
make: make: Leaving directory `/home/pi/rpi_i2c_fcn_rtt’
*** [linuxUDP.o] Error 1
I am using the studentversion of Matlab R2013a, could this be the problem?
Thanks for helping! Max
Answers (1)
Nice to see someone using the RaspberryPi like this.
Two issues: you need to include stdio.h (for the definition of popen and the type FILE) and you’ll likely run into the problem described in:
You can add:
coder.cinclude(‘<stdio.h>’);
to your source code to include stdio.h.
Not defining _XOPEN_SOURCE or related as that post describes causes the C compiler to assume that popen returns an integer which you are then assigning to a FILE *, so it complains.
To follow the suggestion of defining _XOPEN_SOURCE to 500 you could update the build settings in «Simulation -> Model configuration parameters -> Code generation». Copy the TMF file you are using somewhere you can edit it:
copyfile([matlabroot ‘/rtw/c/grt/grt_unix.tmf’],‘./grt_posix.tmf’)
if you were using the grt default TMF file. In this file add a preprocessor define
(or whatever you need) to a line like:
CPP_REQ_DEFINES = -DMODEL=$(MODEL) -DRT -DNUMST=$(NUMST)
-DTID01EQ=$(TID01EQ) -DNCSTATES=$(NCSTATES) -DUNIX …
Finally enter the path to your new file in the «Template makefile» box in configuration parameters.
Also, are you passing a uint8 array to FGETS intentionally? You may consider allocating a character array instead:
res = coder.nullcopy(blanks(10));
as passing an unsigned array may cause the compiler to complain again.
Lastly, you may want to consider passing an appropriate integer type for the second argument of FGETS as it expects an int:
In MATLAB writing 10 means a double with the value of 10 (similar to 10.0 in C). So passing something like int32(10) (or whatever matches int on the Pi) could be preferable.
See Also
Categories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.