Was just testing a simple hello world mqtt program on my mbed board and I keep getting this error:
Error: Cannot open source input file "fsl_enet.h": No such file or directory in "EthernetInterface/lwip-eth/arch/TARGET_Freescale/k64f_emac_config.h", Line: 33, Col: 23.
Error
I even tried fixing the error by doing what the compiler suggests by adding mbed-dev library, but the error is still there.
#ifndef K64F_EMAC_CONFIG_H__
#define K64F_EMAC_CONFIG_H__
#include "fsl_enet.h"
#define ENET_RX_RING_LEN (16)
#define ENET_TX_RING_LEN (8)
#define ENET_ETH_MAX_FLEN (1522) // recommended size for a VLAN frame
#if defined(__cplusplus)
extern "C" {
#endif
int phy_link_status(void);
#if defined(__cplusplus)
}
#endif
#endif // #define K64F_EMAC_CONFIG_H__
Looks like the EthernetLibrary was broken recently for K64F. If you import https://developer.mbed.org/teams/mqtt/code/HelloMQTT/, and choose NOT to update libraries it compiles fine for K64F.
thanks for reporting. The tools scripts were not updated (+ mbed lib), which caused this breakage in the ethernet library. Because ethernet lib requires some new KSDK files which are not yet available.
The next mbed SDK release is tomorrow, which should fix this. In the meantime, we will look at this, to find better solution - for instance to move the target code in the lwip/arch into HAL. I'll have a look today.
Related
Toolchain is the SW4STM32, gcc, processor is STM32F303K8 (Nucleo 303K8), minimal test project with no actual user code at all.
The process how to convert a project generated by ST CubeMX is well documented and apparently works. However, when i specify FreeRTOS in Cube, linker fails to find the init function MX_FREERTOS_Init(). The function prototype is included in main.cpp and the definition exists in another source file (freertos.c). This works in C but when converting the project to C++ the linker fails to link the function.
The C2C++ conversion i did as follows:
add ccnature to the .project file
copy main.c to main.cpp (& remove main.c from the build)
duplicate gcc compiler settings over to g++ in project properties
point linker script to the one in the project directory
The above enable Eclipse to compile main using g++ and to link using G++ linker. However linking consistently fails in ...\Debug/../Src/main.cpp:97: undefined reference to `MX_FREERTOS_Init()'
What is remarkable is that even when i delete all references to MX_FREERTOS_Init() from main.cpp so that the text simply does not exist anywhere, linker STILL fails exactly the same. It even reports the same line number even though the text is completely different. This behavior does not change never mind if i clean the project, rebuild and refresh all indexes etc etc.
Any suggestions anyone? Or do i have to skip specifying FreeRTOS in Cube and do it all manually?
I have the same question using atollic for stm32,
solved by adding extern "C" to main.cpp
/* USER CODE BEGIN PV */
/* Private variables ---------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config();
void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */
/* USER CODE BEGIN PFP */
/* Private function prototypes -----------------------------------------------*/
#ifdef __GNUC__
/* With GCC, small printf (option LD Linker->Libraries->Small printf
set to 'Yes') calls __io_putchar() */
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
#else
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
#endif /* __GNUC__ */
#ifdef __cplusplus
}
#endif
/* USER CODE END PFP */
I have faced with the same issue.
So, I would like to suggest renaming freertos.c file to freertos.cpp.
I would suggest a C++ RTOS for example the free disortos. (Google it)
I installed zlib 1.2.8 and built the miniunzip and minizip projects to test creating and opening a zip.
I built as debug on visual studio 2010 32 bit, with the debug dll zlibwapid .
Minizip worked fine to create a zip file however miniunzip failed to open the zipfile created, and looking in miniunz.c the failure is because:
uf = unzOpen2_64(zipfilename,&ffunc); returns 0.
I saw the code is wrapped as follows in defines:
#ifdef USEWIN32IOAPI
fill_win32_filefunc64A(&ffunc);
uf = unzOpen2_64(zipfilename,&ffunc);
#else
uf = unzOpen64(zipfilename);
#endif
On a hunch I changed the define at the top to:
#ifdef _WIN32
//#define USEWIN32IOAPI //disabled this
#include "iowin32.h"
#endif
Now mininunzip works fine but I dont really know why. Anyone know if this is a known bug , I couldnt find any information about it.
Thanks
I'm using SDL for opening a window and handeling events. And OpenGL to render my objects to the screen. SDL_mixer for sound, and SDL_ttf for text. Now I'm trying to figure out how to be able to put a video on display. Like an animated logo or something before the game starts. Just to experiment with it. At some point I will need to know it...
I've found and tried installing FFMPEG, I've included the "include" folder, and set the "lib" folder. At first I got an error telling me it was unable to load "inttypes.h". So I downloaded a package with that and put it in the include folder for FFMPEG.
Now I'm stuck with this error, which I can't seem to be able to solve.
c:\program
files\ffmpeg-20140507-git-4cdea92-win64-dev\include\libavutil\common.h(87):
fatal error C1004: unexpected end-of-file found
And another question, is there other libraries aviable that may be easier to use for displaying a simple video? I read something about SDL being able to do it, but nothing was to be found about it.
EDIT: Here is line 78 to 96:
#if FF_API_AV_REVERSE
extern attribute_deprecated const uint8_t av_reverse[256];
#endif
#ifdef HAVE_AV_CONFIG_H
# include "config.h"
# include "intmath.h"
#endif
/* Pull in unguarded fallback defines at the end of this file. */
#include "common.h"
#ifndef av_log2
av_const int av_log2(unsigned v);
#endif
#ifndef av_log2_16bit
av_const int av_log2_16bit(unsigned v);
#endif
Wrap your #include <libav*.h>s inside a block like this:
#ifndef __STDC_CONSTANT_MACROS
#define __STDC_CONSTANT_MACROS
#define UNDEFINE_STDC_CONSTANT_MACROS
#endif
extern "C"
{
#include <libavdevice/avdevice.h>
#include <libavdevice/version.h>
}
#ifdef UNDEFINE_STDC_CONSTANT_MACROS
#undef __STDC_CONSTANT_MACROS
#endif
There's probably a way around using the UNDEFINE_STDC_CONSTANT_MACROS hack but the logic just isn't coming to me right now.
Worked for me on VS2012 using Zeranoe's 32-bit ffmpeg development binaries and msinttypes' inttypes.h.
Hmm, I found the DLL-files, and it gave me a linker error with the 64-bit library.
I changed back to 32-bit and the 32-bit dlls and it worked fine. I guess that libraries ask if you have 32/64-bit Visual Studio insteath of Windows.
I have a very trivial problem including a chain of C libraries into a C++ main project. I've experience with C but it's the first time that I'm programming in C++.
The structure of the project is a single folder with inside:
main.cpp
Mylib_1.c
Mylib_1.h
Mylib_2.c
Mylib_2.h
main calls -> Mylib_1.h that calls -> My_lib2.h
//main.cpp
#include "Mylib_1.h"
//Mylib_1.h
#include "Mylib_2.h"
main contains both Mylib_1 and Mylib_2 functions and typedef structs
Mylib_1 uses typedef structs and functions of Mylib_2
Everything inside each Mylib_x.h is wrapped between extern "C", like this:
#ifndef __MYLIB_X_H
#define __MYLIB_X_H
#ifdef __cplusplus
extern "C" {
#endif
mycode
#ifdef __cplusplus
}
#endif
#endif
But when I try to compile it with eclipse kepler on Ubuntu 12.04 x64, I get:
Mylib_1.h error: Mylib_2_type_t does not name a type
main.cpp error: Mylib_2_function1 was not declared in this scope
...
Only the above sections are marked as error in eclipse, the header looks included fine.
Furthermore according to eclipse, the __cplusplus flag is false into Mylib_2.h but true into Mylib_1.h
Thinking of some eclipse error, I've tried to manually build the project via g++ (v4.6.3) but I got the same exact problem when I've tried to link the libraries .o with the main.cpp
Seems stupid but I can't figure out what could it be. Any suggestion?
Thank you
Have you checked that your lines
#ifndef __MYLIB_X_H
#define __MYLIB_X_H
are really different for the two files,
e.g. _MYLIB1_H and _MYLIB2_H?
I'm trying to port a Linux library to run on VxWorks. I have successfully built binutils and gcc to target i486-wrs-vxworks and I can successfully build a simple C program. However, when I try to compile C++, things break.
I have a simple Hello World program:
#include <string>
#include <iostream>
int main()
{
std::string s = "Hello World";
std::cout << s << std::endl;
return 0;
}
To build it, I call:
i486-wrs-vxworks-gcc -I/home/kyle/vxworks-6.9/target/usr/h -I/home/kyle/vxworks-6.9/target/usr/h/c++ hello.cpp
This always fails with the message:
In file included from /home/kyle/vxworks-6.9/target/usr/h/c++/cerrno:4:0,
from /home/kyle/vxworks-6.9/target/usr/h/c++/xlocnum:4,
from /home/kyle/vxworks-6.9/target/usr/h/c++/ios:4,
from /home/kyle/vxworks-6.9/target/usr/h/c++/ostream:4,
from /home/kyle/vxworks-6.9/target/usr/h/c++/istream:4,
from /home/kyle/vxworks-6.9/target/usr/h/c++/string:4,
from hello.cpp:1:
/usr/local/lib/gcc/i486-wrs-vxworks/4.6.4/../../../../i486-wrs-vxworks/include/yvals.h:4:24: fatal error: yvals.h: No such file or directory
If I go look inside /usr/local/i486-wrs-vxworks/include/yvals.h, this is what I see:
/* yvals.h values header for conforming compilers on various systems */
#if (defined(__cplusplus) && defined(__GNUC__))
/* GCC C++ has it's own yvals.h */
#include_next <yvals.h>
#else /* __cplusplus && __GNUC__ */
#ifndef _YVALS
#define _YVALS
#ifdef _NO_WINDRIVER_MODIFICATIONS
#include <stdarg.h>
#endif
...
It appears that there is another yvals.h that needs to be included, but I can't find it anywhere. Did I just fail at building gcc correctly, or is there a way to fix this?
Which version of VxWorks are you using for this?
I have a fuzzy recollection that when upgrading VxWorks versions in the past there was a syntax error in yvals.h that was I needed to work around and it was fixed in a subsequent version.
Also, you can get the gcc cross compiler pre-built from WindRiver. Just login to windriver.com/support with your licence number and head to "Downloads" for your product version.
I went through a recent cross compiling nightmare myself (not VxWorks related) except that instead of yvals.h, I was having grief with stddef.h. The problem turned out to be that I needed to specify the include paths for the system header files.
Here are the steps it took me to solve my error messages. Feel free to modify as appropriate.
Create a file foo.c
#include <stddef.h> /* The problem header file (yvals.h for you?) */
int main (void) {
return 0;
}
Compile it with your compiler of choice
$(CC) foo.c -E
Note the include paths it uses and set them as your system header file list using the
-isystem <include path>
option.
Hope this helps.