I have downloaded the well-known linuxptp source code (C language) from:
git clone git://git.code.sf.net/p/linuxptp/code linuxptp
It is a makeFile project which I could successfully run from command line, however the problem appears when I try to import it to Eclipse:
File > New > Makefile project with existing code
I can successfully build it and run it but I couldn't debug or force it to stop at a break point. I keep getting the message (No source available for "main() at 0x401eb5").
I tried to reinstall Eclipse IDE for C/C++ Developers from the official website but it didn't work.
I think it is useful to mention that:
- the source code I'm using contains different files with main() function
- Eclipse debugger runs successfully on projects created on Eclipse from scratches
Any ideas?
thanks.
You should create some debugging launch configurations for your different executables in the project.
Also be sure that the Makefiles include -g option when compiling to produce the required debugging information.
Edit:
Add this lines to your Makefiles:
CFLAGS += -g
CXXFLAGS += -g
Related
I’ve recently done a git clone of the wine repository at https://github.com/wine-mirror/wine and downloaded the folders to (~/repo/wine/). I'm trying to run Notepad, but don't know how. I am assuming that to build and compile it, I would need to run main.c from the notepad folder. I’m running GCC v 8.3.0 on Raspbian/Linux 10
With the repo downloaded as shown above, what build commands would I need to run notepad’s main.c from Geanie (or any, currently using Geanie) IDE? Can a single compile and/or build command let me run notepad from Geanie, or am I missing something?
Other details (not needed if what I thought I was going to do can't be done):
I wanted to try to run main.c at (~/repo/wine/programs/main.c), but don’t know how to get GCC to view all of the necessary header files. In my execution instructions window in Geanie, I have
gcc -Wall -c “%f” /home/pi/repo/wine/include
and my build instruction (it won't compile, so this isn't anything I've even gotten to work with yet...)
gcc -Wall -o “%e” “%f” /home/pi/repo/wine/include
When I attempt to compile, I get:
Stdio.h:11:10: fatal error: corecrt_wstdui.h: No such file or directory.
#include <corecrt_wstudio.h>
I went over to the stdio.h and attempted to add a build instruction here as well that also targets the include folder (which is the supposedly missing file), but it won’t compile.
Using cpp -v, I can see my include paths for GCC are as follows:
#include”...” paths:
#include<...> paths:
\usr\lib\gcc\arm-linux-gnueabihf\8\include
\usr\local\include
\usr\lib\gcc\arm-linux-gnueabihf\8\include-fixed
\usr\include\arm-linux-gnueabihf
\usr\include
I'm trying to set up CMake for a project I'm working on, and I'm first trying to compile a simple Hello World program in C. I'm using Windows 10 with MSYS2. If I invoke the compiler (GCC) directly in Bash, it compiles fine without warnings or errors and gives an executable as output which prints "Hello, world!" exactly as expected. My problem comes in when I try to use CMake to compile my project. When I run cmake -G Ninja .. to compile my project, it throws this error:
CMake Error at C:/msys64/mingw64/share/cmake-3.15/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"C:/msys64/mingw64/bin/cc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/dylanweber/Documents/C-Projects/webapp/build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/msys64/usr/bin/ninja.exe cmTC_45340 && [1/2] Building C object CMakeFiles/cmTC_45340.dir/testCCompiler.c.obj
FAILED: CMakeFiles/cmTC_45340.dir/testCCompiler.c.obj
C:\msys64\mingw64\bin\cc.exe -o CMakeFiles/cmTC_45340.dir/testCCompiler.c.obj -c testCCompiler.c
/bin/sh: C:msys64mingw64bincc.exe: command not found
ninja: build stopped: subcommand failed.
Notice how it mentions C:msys64mingw64bingcc.exe... there must be some kind of path delineation problem but I've tried setting the CC environmental variable to C:\\msys64\\mingw64\\bin\\gcc.exe and C:/msys64/mingw64/bin/gcc.exe. I have been clearing the CMake caches between runs.
Here is my CMakeLists.txt file:
cmake_minimum_required(VERSION 3.15)
project(webapp)
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/build)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
file(GLOB SOURCES "main/*.c")
add_executable(webapp ${SOURCES})
My code is in a "main" folder which is currently just one "main.c" file, in addition to a build directory used to keep all the temporary files in. The most frustrating part is that CMake was just working an hour ago, and I didn't change anything. What can I do to fix this problem?
The solution was not only installing the MinGW64 version of CMake, but also the MinGW64 version of Ninja as well. Since they have different pathing schemes compared to MSYS, they didn't play well together until they were both on the same POSIX-like platform.
I have the MinGW install previously working fine with MSYS. They are installed properly and functioning just well.
I installed the PortAudio library and did the install and got the success message after:
./configure
make
make install
When I try to compile samples:
c:\c>gcc patest_mono.c -o pa.exe
patest_mono.c:50:23: fatal error: portaudio.h: No such file or directory
#include "portaudio.h"
^
compilation terminated.
I'm new. I have a feeling I might be doing something fundamentally wrong with the way I'm trying to create the exe from compiling. It's been somewhat of a puzzle quest so far, but I've tried to figure it out and think I am close but completely missing something.
PATH variable ?
In the PortAudio MinGW build instructions I noticed
"The above should create a working version though you might want to
provide '–prefix=<path-to-install-dir>' to configure. "
I've tried adding C:\MingW\PortAudio into the user path. Doesn't work.
I've also tried running the commands in Bash and they come back with an error message "No Rule to make target 'paexpink'" either with the make command, and with gcc .c -o .exe I just get the same error message as compiling straight from the cmd prompt.
I found another source on stack overflow thread with no answers, but the user had commented that http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio provided them a solution but I tried installing the 5 cpython binaries and under the assumption I did it right, it didn't work either.
Thanks for your help,
Julian
To build and install portaudio, you need to add -prefix=/c/<"path to base of the MinGW directory"> to the ./configure line.
For example: ./configure -prefix=/c/MinGW/
then continue the installation by doing
make
After that, do the
make install
and that should install the portaudio files into MinGW.
After it has finished installing, you need to add -lportaudio to the compile command whenever you compile any programs that you want to use PortAudio in.
For example: gcc -o test test.c -lportaudio
I just figured out how to do this today, so I may have accidentally forgotten a few steps.
I've been trying to add gstreamer in Eclipse for cross-platform compilation of an Variscite I.mx6 development kit. GStreamer-SDK is installed according to Installing on Linux - GStreamer SDK documentation - GStreamer SDK documentation for the Ubuntu Host I'm running eclipse on. Now the problem is; according to the Ubuntu installation guide, I need to include into the gcc command the following string:
pkg-config --cflags --libs gstreamer-0.10
Most solutions i found on the web add this string to the eclipse project settings under C/C++ Build->Settings and configure there the gcc command line. Since I'm using the yocto project with the Yocto Project-plugin in Eclipse, I don't have access to those tabs anymore as I use a toolchain to cross compile my application. I've found other solutions from modifying the make file (http://ubuntuforums.org/showthread.php?t=1164725) or adding the command line to the Autotools configure settings. I've tried both, but they didn't work. I've also added the gstreamer SDK under Includes with the following path: /opt/gstreamer-sdk/.
If anyone could help me out with this problem on how to configure Eclipse or my makefile, I'd be most grateful.
follow this instruction to compile gstreamer sdk using eclipse IDE
Note:
compile using hello world gstreamer application program
goto properties in your project->c/c++build->tool settings->settings
under gcc compiler select the include section and add the following details
/opt/gstreamer-sdk/include/gstreamer-0.10
/usr/include/gstreamer-0.10
/opt/gstreamer-sdk/include
/opt/gstreamer-sdk/include/glib-2.0
/opt/gstreamer-sdk/lib/glib-2.0/include
/opt/gstreamer-sdk/include/glib-2.0/glib
/opt/gstreamer-sdk/include/glib-2.0/gobject
/opt/gstreamer-sdk/include/libxml2/
/opt/gstreamer-sdk/include/ogg
/opt/gstreamer-sdk/include/theora
/opt/gstreamer-sdk/include/vorbis
/opt/gstreamer-sdk/include/wavpack
/opt/gstreamer-sdk/include/gtk-2.0/gtk
now goto Build Steps section
and add this command into pre-build steps
/opt/gstreamer-sdk/bin/gst-sdk-shell
goto c/c++ Build->Environment and add the following data into it
Note:these information are noting but script data from "/opt/gstreamer-sdk/bin/gst-sdk-shell"
GSTREAMER_SDK_ROOT /opt/gstreamer-sdk
GST_REGISTRY_1_0 ${HOME}/.cache/gstreamer-1.0/gstreamer-sdk-registry
XDG_CONFIG_DIRS /etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:${GSTREAMER_SDK_ROOT}/etc/xdg${XDG_CONFIG_DIRS:+:$XDG_CONFIG_DIRS}:/etc/xdg
LDFLAGS ${GSTREAMER_SDK_ROOT}/lib ${LDFLAGS}
XDG_DATA_DIRS /usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/:${GSTREAMER_SDK_ROOT}/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}:/usr/local/share:/usr/share
PYTHONPATH ${GSTREAMER_SDK_ROOT}/lib/python2.7/site-packages${PYTHONPATH:+:$PYTHONPATH}
GIO_EXTRA_MODULES ${GSTREAMER_SDK_ROOT}/lib/gio/modules
CXXFLAGS ${GSTREAMER_SDK_ROOT}/include ${CXXFLAGS}
GST_PLUGIN_SCANNER ${GSTREAMER_SDK_ROOT}/libexec/gstreamer-0.10/gst-plugin-scanner
GST_PLUGIN_SCANNER_1_0 ${GSTREAMER_SDK_ROOT}/libexec/gstreamer-1.0/gst-plugin-scanner
CFLAGS ${GSTREAMER_SDK_ROOT}/include ${CFLAGS}
PKG_CONFIG_PATH /opt/gstreamer-sdk/lib/pkgconfig:${GSTREAMER_SDK_ROOT}/lib/pkgconfig:${GSTREAMER_SDK_ROOT}/share/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}
PATH /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/sbin:/sbin:/usr/games:/usr/local/games:${GSTREAMER_SDK_ROOT}/bin${PATH:+:$PATH}:/usr/local/bin:/usr/bin:/bin
GST_REGISTRY ${HOME}/.gstreamer-0.10/gstreamer-sdk-registry
LD_LIBRARY_PATH /usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/client:/usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386:${GSTREAMER_SDK_ROOT}/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
save the project and build it .. it should compile without error
now add the argument files into the run configuration
right click the project and select RunAs->RunConfiguration->create new(if not created)config file->argument(x)
add the input files and output files here
ex:
test.ogg output-test.ogg
now run the project if everything is fine.
Note:
this above procedure is for x86 architecture only if you are using other than x86 arch ,then include appropriate architecture libraries and files to compile and exclude which are not needed!!!!!
I'm writing a C project in Eclipse and while trying to run it I get the following error message:
(Cannot run program "make": Launching failed)
My Makefile is:
all : GenericHashTable.o TableErrorHandle.o
gcc -Wall GenericHashTable.o TableErrorHandle.o -o all
GenericHashTable.o : GenericHashTable.c GenericHashTable.h TableErrorHandle.h
gcc -Wall -c GenericHashTable.c -o GenericHashTable.o
TableErrorHandle.o : TableErrorHandle.c TableErrorHandle.h
gcc -Wall -c TableErrorHandle.c -o TableErrorHandle.o
clean :
rm all *.
Is the formatting broken in your makefile or in your question? Commands on the line below the target & dependencies. Does this makefile work from the command line?
Assuming the makefile is correct check the obvious things such as ensuring Eclipse can see your toolchain. Perhaps it can't even find the make command or you haven't set it from preferences.
Also the CDT offers a managed makefile and a standard (manual) makefile. The managed means Eclipse will create the makefile for you. The standard makefile is a makefile you are responsible for writing. Perhaps if your project is simple you should use the managed makefile to save yourself the hassle of writing one.
You can try the internal builder from eclipse:
Project->Properties->C/C++ Build
There (in the top level of C/C++ Build) you find Builder Settings->Builder Type which you set to Internal Builder. This way CDT does not require an external make command.
Either use the internal builder as "Turbo J" already suggested or make shure 'make' is in your PATH.
You can set the PATH for the build process in the Project-Properties in 'C/C++ Build -> Environment' - click "Select..", choose PATH and then change it by adding the correct path for the 'make' command.
This way you can also set the PATH of your compiler - that may be necessary if you use the Internal Builder.