missing library "jansson_private_config.h" in Jansson c parser library [closed] - c

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
Anyone ever used jansson C-parser for parsing JSON objects. I was trying to study the library, for same I compiled it with the sample program given with it. Added the header files required but one header file is missing named "jansson_private_config.h" I have downloaded this library completely I am not sure where I can get this ??

You can find in documentation how to build this library for windows:
Get CMake and Visual Studio
unpack source
In a command line
cd .../jansson-2.12
mkdir build
cd build
cmake -G "Visual Studio XX 20XX" ..
You should be done
Alternate method
You can also edit manually the jansson_config.h.in, ommitting to define HAVE_CONFIG_H which cause the jansson_private_config.h to be included in .c files.
Note that this #ifdef HAVE_CONFIG_H test has been forgetten in test_dump.c, which won't compile if you don't fix it.
Fix proposal (not tested):
+#ifdef HAVE_CONFIG_H
#include "jansson_private_config.h"
+#endif

Related

How to build/install libcurl on windows with MinGW [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 months ago.
Improve this question
I have installed MinGW-w64 with MSYS to compile a project I built on Linux on Windows. I do not want to use MSVC, though I did find info on how to build libcurl with it. On Linux I just installed libcurl with "pacman -S libcurl" and could do.
#include <curl/curl.h>
...
I tried to install the precompiled libraries for windows from https://curl.se/windows/ but I have no idea where to put the files from "include" and the files from "lib"
EDIT
I checked https://curl.se/download.html and it seems like I only need the headers and not the all the binaries since curl is already installed on Windows 10. However the only ways there seems to be to install libcurl header files is either with vcpkg which I do not really want to use and cygwin which seems redundant because I have MinGW-w64 installed. Is there a way to install the libcurl package without vcpkg or cygwin.
I found a solution! On MSYS2 just do "pacman -Sy mingw-w64-x86_64-curl" which installs the binaries and the header files. The info was here https://everything.curl.dev/get/windows/win-msys2 and I have no idea why this is not in the curl downloads page or why MinGW on MSYS is not mentioned at all.

Unable to compile software package with CMake Errors [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I'm trying to compile an engineering software tool called FlameMaster using cmake, and I'm getting an error of the following:
[ 1%] [FLEX][FlameManScanner] Building scanner with flex 2.5.35
[ 2%] Built target Alligator
[ 3%] Built target configure_source_sripts
gmake[2]: *** [src/FlameMan/lexer.yy.C] Error 141
gmake[2]: *** Deleting file `src/FlameMan/lexer.yy.C'
gmake[1]: *** [src/FlameMan/CMakeFiles/FMObjects.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
[ 10%] Built target ArrayMan
gmake: *** [all] Error 2
Prior to this, I modified the CMakeLists.txt to point to my c++ compiler and Mac OS X sdk location:
set(CMAKE_CXX_COMPILER "/usr/bin/c++")
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk")
and ran (from directory "Build" alongside "Repository"):
rm -rf *
cmake ../Repository/ -DCMAKE_BUILD_TYPE=Release
which doesn't seem to throw any errors. The error above comes when I run:
make --build . --parallel --target install --config Release
Any ideas on where to start with this error code?
Edit: based on some comments, I adjusted the cmakelists and used the build commands as suggested, and removed —parallel. The error is still occurring identical, even after rm -rf * and remaking ../repository as outlined
Its possible that your build is being affected by the --parallel option, so I'd suggest removing that and trying again. Also, I don't know if it was a typo in your post but the command to build the project should be cmake not make.
Just as a word of CMake advice, typically speaking you should never have to modify another project's CMakeLists.txt directly in order to build, that file should only be touched by the people who originally wrote the code. If you need to override the values of variables, you can do so from the command line (the same way you're already setting CMAKE_BUILD_TYPE=Release)
i.e. from the build directory, you can run this and it will have the same effect as the edits you made to the file
cmake ../Repository/ -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER="/usr/bin/c++" -DCMAKE_OSX_SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk"
However, as mentioned by [#Kuba] in a comment, CMake usually does a pretty good job automatically detecting compiler and SDK locations, so unless you've heavily customized your system it probably isn't necessary to set those variables.
And one final cmake tip: if you successfully build the 'install' target it will install all the files into the default location for whatever system you're on: (/usr/local for UNIX and C:\Program Files\ for Windows).
Unfortunately, CMake doesn't provide any easy way to 'uninstall' the program later after its been installed. So if you think you may want to remove the program in the future, it may be better to change the install location to somewhere else.
You can do this by setting the CMAKE_INSTALL_PREFIX variable, just add
-DCMAKE_INSTALL_PREFIX=/path/to/desired/install/location to your cmake configuration command.

How can I compile .C to .exe and edit the view? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I wrote 2 programs in C (one encoder and one decoder with random encryption key every second) and I want to compile those 2 programs to .exe to publish it.
Can you please help me how to compile it?
I tried with Visual Studio and Pycharm with tkinter. But it's like a totally new language for me. In Linux I compiled it via terminal to .exe.
To compile to .exe open the command prompt and type this:
gcc fileName.c - compiling and linking, produces a.exe
or
gcc -c fileName.c - only compiling, produces fileName.o object file
gcc -o test filename.o - linking and produces test.exe
If there are more than 1 source file you can do the just compiling part for all files and generate object files.Then do the linking by adding their names in the command.Of curse this is applicable if there are less files but for a bigger project you have to write a makefile.
You are searching for a compiler, like GCC or Clang. If you are developing on Windows, I recommend MinGW (GCC for Windows). Then you can compile and link your source code to an .exe file using the commandline, just like you did on linux.
Your IDE (like Visual Studio) is basically doing the same, you just don't see it. If your IDE is configured properly, it should work just fine.

I got stuck with my first code in C programing language, I cannot make an excutable file? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I used to compile and run C codes in windows OS using code block program, at the mean time, I am using LINUX OS (Ubuntu 14.10 LTS)
I've created a simple program (hello ,world!). This is the code
#include<stdio.h>
int main(void)
{
printf("Hello! This is a test prgoram.\n");
return 0;
}
Its name is demo.c
When I try to make an executable file demo via:
gcc demo.c -o demo
I cannot get a green executable file!!!!!!!!!!
When I try
./demo
I get
bash: ./demo: Permission denied
for more informations, I have posted the outputs of some command in the following link
https://unix.stackexchange.com/questions/259982/error-while-compiling-my-first-program-in-c-language?noredirect=1#comment451370_259982
From the output of the various commands in your other question, it looks like you are using a file system that does not respect or store file permissions (is this an NTFS partition used by Windows and you configured the machine for dual boot?).
Try working in a directory that is on a native Linux file system, for example your home directory.
bash: ./demo: Permission denied
Just ensure your executable is created and then Change permission by doing
chmod u+x <executable name>
This will give the x - "execute" permission for the "owner" - u of the file, which should be enough to execute the file, provided it is an executable.

how to compile programs with .a and .h extension [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Using osx how do I run a program I got on the internet that comes with a .a and another file that comes with a .h file.
I'm using a mac terminal.
File with .a extension is an archive library and File with .h extension is a header file to expose the internals of the library.
These files cannot be run!
You need to include the header (.h) in your source and link the library (here ``libx) using e.g.
gcc -o myprog myprog.c -L/path/to/libx -lx

Resources