Compiling/using libjpeg in Windows for Eclipse - eclipse

This question/answer will eventually serve as complete answer for this question: How can I manipulate/rotate a JPEG image in C++? Since the answers given to that question are only useful if you have already done all of this below.
I followed the guide here: Compiling libjpeg
(The accepted answer guide using MINGW32 Shell)
It doesn't work despite having downloaded a fresh copy:
$ make
make all-am
make[1]: Entering directory `/c/tmp/jpeg-9'
CC jaricom.lo
CC jcapimin.lo
jcapimin.c:127:1: error: conflicting types for 'jpeg_suppress_tables'
jcapimin.c:128:1: note: an argument type that has a default promotion can't matc
h an empty parameter name list declaration
In file included from jcapimin.c:22:0:
jpeglib.h:997:14: note: previous declaration of 'jpeg_suppress_tables' was here
make[1]: *** [jcapimin.lo] Error 1
make[1]: Leaving directory `/c/tmp/jpeg-9'
make: *** [all] Error 2
8d and 9 both do the same.
After making the change noted in this question: Compile libjpeg with mingw
Add the following definition to the jconfig.h
#define HAVE_PROTOTYPES 1
I get this output when making:
$ make
make all-am
make[1]: Entering directory `/c/tmp/jpeg-9'
CC jaricom.lo
In file included from jinclude.h:20:0,
from jaricom.c:17:
jconfig.h:5:24: warning: extra tokens at end of #undef directive [enabled by def
ault]
CC jcapimin.lo
In file included from jinclude.h:20:0,
from jcapimin.c:21:
jconfig.h:5:24: warning: extra tokens at end of #undef directive [enabled by def
ault]
jcapimin.c:127:1: error: conflicting types for 'jpeg_suppress_tables'
jcapimin.c:128:1: note: an argument type that has a default promotion can't matc
h an empty parameter name list declaration
In file included from jcapimin.c:22:0:
jpeglib.h:997:14: note: previous declaration of 'jpeg_suppress_tables' was here
make[1]: *** [jcapimin.lo] Error 1
make[1]: Leaving directory `/c/tmp/jpeg-9'
make: *** [all] Error 2
Then you have to run "autoheader" to fix this and make again.
It supposedly made but there is nothing in my build directory set by ./configure --prefix=/c/tmp/jpeg-9-build/
I found the libjpeg-9.dll in the .lib folder within the project directory.
Messy..Now the question is: How do I use it in Eclipse?
I have the exe's in the main directory, some exe's and the DLL in the .lib sub-directory but no .lib file - How do I go about importing these into an eclipse project so that I can call functions in the DLL?
$ make install gathered the files in the build directory.
I migrated the contents of the build directory into the working Eclipse project and linked the library and include paths:
I'm not sure if this is right for how I want to use it but it's something and it compiles. Next part: Calling functions out of the DLL?
Related to using compiled jpegtran.exe: jpegtran.exe not correctly rotating image
Trying to use libraries and compile in separate project: Need help compiling jpegtran.c code from libjpeg
Current issue: Need help compiling jpegtran.c code from libjpeg

Your advice for updating the jconfig.h file to #define HAVE_PROTOTYPES 1 is only a band-aid solution for a deeper problem: jconfig.h is corrupted and has incorrect #undef for many important items your compiler supports.
The proper way to work around this is to follow the install.txt advice to manually compile ckconfig.c and have it generate a jconfig.h for you, then proceed to make, and make install.

Related

Problems to recompile a UE4 plugin

I am trying to recompile the Dialogo System plugin (https://forums.unrealengine.com/t/dialogue-system/44974) and I can't do it at all. I've tried several ways, including those suggested by the forum staff, but there's no way
This the error message I am getting:
Running C:/Program Files/Epic
Games/UE_4.26/Engine/Binaries/DotNET/UnrealBuildTool.exe Development
Win64 -Project="D:/Simulation/unreal/MyProject/MyProject.uproject"
-TargetType=Editor -Progress -NoEngineChanges -NoHotReloadFromIDE Invalidating makefile for MyProjectEditor (DialogueSystem.Build.cs
modified) #progress push 5% Parsing headers for MyProjectEditor
Running UnrealHeaderTool
"D:\Simulation\unreal\MyProject\MyProject.uproject"
"D:\Simulation\unreal\MyProject\Intermediate\Build\Win64\MyProjectEditor\Development\MyProjectEditor.uhtmanifest"
-LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -abslog="C:\Users\renat\AppData\Local\UnrealBuildTool\Log_UHT.txt" -installed Reflection code generated for MyProjectEditor in 4,3286771 seconds #progress pop
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\BTComposite_Context.cpp(1):
error: Expected BTComposite_Context.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\BTComposite_Question.cpp(1):
error: Expected BTComposite_Question.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\BTComposite_QuestionGroup.cpp(1):
error: Expected BTComposite_QuestionGroup.h to be first header
included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\BTContextNode_Interface.cpp(1):
error: Expected BTContextNode_Interface.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\BTDialogueFunctionLibrary.cpp(1):
error: Expected BTDialogueFunctionLibrary.h to be first header
included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\BTTask_CloseDialogue.cpp(1):
error: Expected BTTask_CloseDialogue.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\BTTask_ShowPhrases.cpp(1):
error: Expected BTTask_ShowPhrases.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\BTTask_WaitAnswer.cpp(1):
error: Expected BTTask_WaitAnswer.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\DialogueButton.cpp(1):
error: Expected DialogueButton.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\DialogueEventListener.cpp(1):
error: Expected DialogueEventListener.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\DialogueSettings.cpp(1):
error: Expected DialogueSettings.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\DialogueSystemModule.cpp(1):
error: Expected DialogueSystemModule.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\QuestBook.cpp(1): error: Expected QuestBook.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystemEditor\Private\BehaviorTreeEditor\QuestionCustomization.cpp(1):
error: Expected QuestionCustomization.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystemEditor\Private\BehaviorTreeEditor\ShowPhrasesCustomization.cpp(1):
error: Expected ShowPhrasesCustomization.h to be first header
included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystemEditor\Private\QuestBookEditor\QuestBookEditor.cpp(1):
error: Expected QuestBookEditor.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystemEditor\Private\QuestBookEditor\QuestBookEditorCommands.cpp(1):
error: Expected QuestBookEditorCommands.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystemEditor\Private\QuestBookEditor\QuestBookEditorCustomization.cpp(1):
error: Expected QuestBookEditorCustomization.h to be first header
included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystemEditor\Private\DialogueSystemEditorModule.cpp(1):
error: Expected DialogueSystemEditorModule.h to be first header
included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystemEditor\Private\DialogueSystemStyle.cpp(1):
error: Expected DialogueSystemStyle.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystemEditor\Private\QuestBookAssetTypeActions.cpp(1):
error: Expected QuestBookAssetTypeActions.h to be first header
included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystemEditor\Private\QuestBookFactory.cpp(1):
error: Expected QuestBookFactory.h to be first header included.
Building MyProjectEditor... Using Visual Studio 2019 14.27.29111
toolchain (C:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\VC\Tools\MSVC\14.27.29110) and Windows
10.0.19041.0 SDK (C:\Program Files (x86)\Windows Kits\10). Building 13 actions with 12 processes... #progress 'Compiling C++ source
code...' 0% #progress 'Compiling C++ source code...' 8% [1/13]
Default.rc2 #progress 'Compiling C++ source code...' 15% [2/13]
Default.rc2 #progress 'Compiling C++ source code...' 23% [3/13]
PCH.DialogueSystem.cpp
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Classes\BTTask_ShowPhrases.h(7):
fatal error C1083: It1s not possible to open file include: 'Widget.h':
No such file or directory
Please, some help. I really need to use this plugin to produce a demonstration of my project.
You could try what the log is suggesting and change the order of the includes. I suppose you're using a c++ project. Sometimes the order does matter.
Also check if the plugin is added in the dependecies list in the build.cs file. This file is located inside your project source folder. You will see that in the file there is already a dependecies list and you should include the plugin name in the list and build again.
BTComposite_Context.cpp(1): error: Expected BTComposite_Context.h to be first header included.
Taking this one as an example it looks like the .cpp files have been either corrupted or modified in a way. In general when you have a .cpp file you'll want it to start with the same header file as the first include. So open one of these files and see whether or not it starts with something like
#include BTComposite_Context.h
My guess since it looks to be an old plugin it probably improperly starts with something like
#include Engine/Core.h
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Classes\BTTask_ShowPhrases.h(7): fatal error C1083: It1s not possible to open file include: 'Widget.h': No such file or directory
This error is actually what's causing you not to be able to compile. Likely because Widget.h has been moved in a future version of UE4 compared to what it was when this plugin was made almost 7 years ago.
Try changing from #include Widget.h to #include "Components/Widget.h"
If you look at Widget.cpp in the engine source you can see this is now the correct include path that is expected.

Issues With Mbed & eclipse compiling

Im not entirely sure if iv misunderstood the instructions on https://os.mbed.com/docs/mbed-os/v5.12/tutorials/eclipse.html
where it states
make[1]: arm-none-eabi-g++: No such file or directory, you need to configure Eclipse's PATH (not your OS PATH).
can someone please clarify what i need to do or if im missing something.
To me this is just asking to go to CMD, where gcc ect -> and paste the location into the PATH under enviroment. i still get the error.
-pasted in the location of where arm-none-eabi-g++ in my PATH
-added C:/cygwin64/bin into my path
installed every single thing under the sun when it comes to mingw/ or anything else remotely connected
01:09:44 **** Incremental Build of configuration Default for project Nucleo_blink_color_led ****
make all
Compile: main.cpp
make[1]: arm-none-eabi-g++: Command not found
make[1]: *** [main.o] Error 127
make: *** [all] Error 2

Programming Arduino with avrdude within Eclipse- cannot find -l/usr/avr

I am trying to program the Arudino Nano from Eclipse. It has the same processor as the Uno (Atmega328p). I have had this working before with the Uno, but have since gotten a new hard drive and had to reinstall/reconfigure everything. I am running Fedora 19 with Eclipse Kepler. I am getting an error in the build process that I don't even know where to start looking to solve, and Google hasn't been much help...
Here is the error:
make all
Building target: Arduino_Template.elf
Invoking: AVR C Linker
avr-gcc -Wl,-Map,Arduino_Template.map -mmcu=atmega328p -o "Arduino_Template.elf" ./Analog.o -l/usr/avr
/usr/lib/gcc/avr/4.8.2/../../../../avr/bin/ld: cannot find -l/usr/avr
collect2: error: ld returned 1 exit status
make: *** [Arduino_Template.elf] Error 1
17:29:38 Build Finished (took 124ms)
Has anyone encountered this before? Or does anyone have any suggestions?
Thanks.
The problem could be described like this:
First, the library should be specified only by its name and without the "lib" prefix and the ".a" suffix. The linker (this is where you get the error) will look for the library within the specified in the project paths and will add whatever is necessary to the file library name. So if the library you need is named mystuff it will look for a file named libmystuff.a.
In your case this is specified by the -l/usr/avr which I think could be misconfiguration or you did not copy/paste the entire error output. With the '-l' option you specify the name only, not the entire path to the file.
Second, the path should be specified, in the project configuration, where to look for the libraries, otherwise the linker will look for the library files only within your own project only. Often libraries are part of another project - so you need to adjust the project configuration accordingly.
I had similar problem and this is how I solved it ...
Go to menu Project/Properties. On left - choose "C/C++ Build". On right - choose the tab "Tool Settings". On the tree view choose "AVR C Linker" then "Libraries" sub-item. You are where you may need to make changes.
The list of "Libraries" is where you add libraries names, such as mystuff.
The Libraries Path is where you specify the paths to the libraries. This may look like this: "${workspace_loc:/mystuff/Release}"
The result of this is that the linker will look for this file: /mystuff/Release/libmystuff.a under you workspace root folder.

Why is Netbeans complaining about my GNUmakefile?

I am making a Netbeans C++ project with an existing GNUmakefile. I went to File -> New Project -> C/C++ with Existing Sources and selected the folder with my current files (including the GNUmakefile).
However, when I run my app, I get the following error.
make: Makefile: No such file or directory
make: *** No rule to make target `Makefile'. Stop.
BUILD FAILED (exit value 2, total time: 67 ms)
I suspect that my Makefile is named "GNUmakefile", which differs from "Makefile." However, I do not want to rename "GNUmakefile," since I am working on this project with others who want to keep it the same.
Is that why Netbeans complains about my GNUmakefile? How can I tell Netbeans to use GNUmakefile instead?
It looks like you must be invoking make as make -f Makefile, so you are explicitly (whether you realize it or not) saying to use a makefile called Makefile. Otherwise, GNU make would happily use GNUmakefile:
$ ls
GNUmakefile
$ cat GNUmakefile
all: ; #echo done
$ make
done
$ make -f Makefile
make: Makefile: No such file or directory
make: *** No rule to make target `Makefile'. Stop.
Note that you only get the error you reported in the last case. So you just need to change how you are invoking GNU make. Alternatively you could symlink Makefile to GNUmakefile:
$ ln -s GNUmakefile Makefile
$ gmake -f Makefile
done

error with "pmem.c" compiling linux source code for android

I am compiling linux source code for android emulator. When i execute make command(for building and cross-compiling the linux source) i get the following error "pmem.c" file.
root#ubuntu:~/common# make
CHK include/linux/version.h
CHK include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-x86
CALL scripts/checksyscalls.sh
CHK include/linux/compile.h
CC drivers/misc/pmem.o
drivers/misc/pmem.c:441: error: conflicting types for ‘phys_mem_access_prot’
/home/preetam/common/arch/x86/include/asm/pgtable.h:383: note: previous declaration of ‘phys_mem_access_prot’ was here
drivers/misc/pmem.c: In function ‘flush_pmem_file’:
drivers/misc/pmem.c:805: error: implicit declaration of function ‘dmac_flush_range’
drivers/misc/pmem.c: In function ‘pmem_setup’:
drivers/misc/pmem.c:1265: error: implicit declaration of function ‘ioremap_cached’
drivers/misc/pmem.c:1266: warning: assignment makes pointer from integer without a cast
make[2]: *** [drivers/misc/pmem.o] Error 1
make[1]: *** [drivers/misc] Error 2
make: *** [drivers] Error 2
root#ubuntu:~/common#
how to resolve this error. It seems that there may some problems in the "pmem.c" file and i'll have to choose different git repository. but that would be a very complex thing, as now i have already done most of the things till here. I might have to see correct version of this file. please someone tell what should i do?
how to solve this errors.
please help..thankyou!
There are several errors in the message you pasted, both conflicting types and implicit declarations. Three things that you might want to verify:
did you choose the correct processor architecture (ARCH) and cross compiler definition
does the chosen architecture mix in files from another arch (this is difficult to check, but you can start by checking the location of the files that are mentioned in the error message)
check these files themselves, to see it this is a bug (very unlikely, but you never know) and that you actually have to change some code