I seem to have problems compiling FLTK programms using anything other than the fltk-config script.
I have copied the source from the "Hello world" program in the tutorial. When I run fltk-config --compile hello.cpp it prints out
g++ -I/usr/local/include -I/usr/local/include/FL/images -mwindows -DWIN32 -DUSE_OPENGL32 -D_LARGEFILE_SOURCE -D_LARGEFILE32_SOURCE -o 'hello' 'hello.cpp' -mwindows /usr/local/lib/libfltk.a -lole32 -luuid -lcomct132
and compiles just fine. But when I print in the same thing myself, it says, that ld.exe cannot find -lcomct132.
I use FLTK 1.3.0 compiled on MinGW under WinXP.
I bet that the fltk-config script is setting environment variables that you have not configured. Check the FLTK documentation and see the proper environment variables you need to set to compile without the helper script.
Edit: Did some research
Apparently you're not the only one that has linking problems. I found a similar problem on the forum here and on the fltk.general newsgroup. The consensus seems to be that order of the linking arguments are important, and that using the fltk-config script is the easiest way to proceed.
I didn't get this specific error, but I did have problem with the "lcomct132". Maybe your error has something related to it. So, in my case, here it was the SOLUTION:
The "132" is in fact only "32". The "1" isn't a number but smallcase letter L. So it is "lcomctl32" !
Related
I'm trying to build this: https://github.com/hselasky/hpsat_generate
this is their makefile:
PROG_CXX=hpsat_generate
PREFIX?=/usr/local
MAN=
SRCS= hpsat_generate.cpp
BINDIR?=${PREFIX}/bin
.if defined(HAVE_DEBUG)
CFLAGS+= -g -O0
.endif
CFLAGS+= -I${PREFIX}/include
LDFLAGS+= -L${PREFIX}/lib -lgmp -lgmpxx
.include <bsd.prog.mk>
using just make . results in
Makefile:7: *** missing separator. Stop.
so after some searching I found that I need to use FreeBSD make, so I tried:
bmake . hpsat_generate
which complains that mergesort is not declared, which is a FreeBSD function so I can only assume it doesn't really includes it.
I tried finding a way to make it run but I'm out of ideas..
The Makefile requires some changes for Linux (and NetBSD). The bsd.prog.mk implementation that comes with bmake on Linux is slightly off, and requires a workaround to link the program correctly, also, on Linux you need libbsd:
These issues are fixed by PR #1.
Instead of running the makefile just execute this:
g++ -o sat sat.cpp -lgmp -lgmpxx -l:libbsd.a
you may need to install the gmp and libbsd libraries
I'm working on a project on a Raspberry Pi 2 Model B. I started coding and compiling directly on the Pi and now I want to work on a Windows 7 PC. I already installed the SysGCC Cross-Compiler and managed to compile a simple Hello-World program.
Problem is, for my Project i use curl and jsoncpp. Natively on the Raspberry i have no problems compiling it, but the cross-compiler on Windows gives me following error:
c:/sysgcc/raspberry/bin/../lib/gcc/arm-linux-gnueabihf/6/../../../../arm-linux-gnueabihf/bin/ld.exe: cannot find -lcurl
c:/sysgcc/raspberry/bin/../lib/gcc/arm-linux-gnueabihf/6/../../../../arm-linux-gnueabihf/bin/ld.exe: cannot find -ljsoncpp
I don't use a makefile or so because i never really worked with that and on the raspi it just worked fine with this command:
g++ ../src/rpi/main.cpp ../src/rpi/connection.cpp ../src/rpi/jsonparser.cpp ../src/rpi/idchecker.cpp ../src/rpi/eventoperator.cpp -o ../bin/main -lcurl -ljsoncpp
On the Windows system i tried it with a command like this:
arm-linux-gnueabihf-g++.exe -std=c++11 ../src/rpi/main.cpp ../src/rpi/connection.cpp ../src/rpi/jsonparser.cpp ../src/rpi/idchecker.cpp ../src/rpi/eventoperator.cpp -o ../bin/main -L"C:/SysGCC/raspberry/arm-linux-gnueabihf/sysroot/usr/include/jsoncpp/json/" -L"C:/SysGCC/raspberry/arm-linux-gnueabihf/sysroot/usr/include/arm-linux-gnueabihf/curl/" -lcurl -ljsoncpp
So i read that i have to tell the compiler/linker where the libraries are, but i don't really understand why since it works perfectly without the -L flag on the Raspi. I think i put the libraries in the same folder as on the Raspi, so i don't understand why they are not found. I hope someone can help me ore give me some short basic explanation on how this stuff works, cause i don't find any working tutorial or other helpful questions for my problem.
On raspberry-pi the libraries are most likely to be linked from system directory like /usr/lib or /usr/local/lib. On Windows, you need to specify the correct path(s) with -L flag.
Based on this question I was able to make one default cmake compilation for GLFW libraries, compile my GLFW App and run; everything works and was made through the terminal since I'm using Ubuntu 14.04 64 bits.
I was using this line to compile:
g++ -std=c++11 -c main.cpp
And this to link:
g++ main.o -o main.exec -lGL -lGLU -lglfw3 -lX11 -lXxf86vm -lXrandr -lpthread -lXi
After use those commands I only needed to execute main.exec. However, I would like to setup eclipse to compile and run this GLFW application. Include files are already settled on the project but I'm having trouble with my linkers. I was trying to track my libraries (GL, GLU, glfw3....) manually to set the folders but I couldn't find all of them. Does anyone know how could I track the libraries to set them on my linker(Project - Properties - C/C++ Build - Settings - GCC C++ Linker) or could give me some guidelines to solve this situation, please?
Thanks in advance
After try and research for some hours, I found the solution which is pretty easy:
Instead of add paths to libraries, just add their names as it is in the command line. I still don't know from where the path reference for those libraries are coming (and would be great if someone could explain) but what is most important is that works. After build just run (CTRL + F11) like any other application.
I am trying to build a binary using a Makefile, however i am seeing this baffling error message "library not found for -lboost_system". The Makefile runs the following:
*g++ BookKeeper.o OptionsBookKeeper.cpp -o OptionsBookKeeper - I/usr/local/Cellar/boost/1.53.0/include -L/usr/local/Cellar/lib/ -L/usr/local/lib/ -L/usr/local/Cellar/boost/1.53.0/lib -lzdb -lQuantLib -lpthread -lboost_system*
Within /usr/local/Cellar/boost/1.53.0/lib resides the following libraries: libboost_system-mt.a and libboost_system-mt.dylib . These look fine with me, is there anything obvious that i have missed out?
thanks in advance
You have the multi threaded build of libboost_system. So use -lboost_system-mt
There is a small project C++ (it has win32 code) that I need to build. It already has its Makefile. I was told to use MinGW. I have never used it before. I downloaded and installed the latest MinGW installer.
Then, I opened the MinGW shell and did make. The exe file was created. But when I try to run it I get libgcc_s_dw2-1.dll is missing! Why do I get this error? Shouldn't the exe be self-contained and run anywhere?
UPDATE
Here's more information, from the Makefile:
CC = g++
CCOPTIONS=-DWINDOWS -DFORCEINLINE -DMINGW -DSRTP_SUPPORT -D__EXPORT= -D_WIN32_WINNT=0x0501 -DNOMVS
setup.exe: setup.o common.o
$(CC) -ggdb -g -O0 -o $# setup.o common.o -mno-cygwin -mwindows -lwsock32 -lws2_32 -lwinmm -lgdi32 -lcomctl32 -lmapi32 -lVfw32
Whether or not the exe should be self-contained depends on how you built it. We need to see the commands that were executed, or post the makefile. But that DLL does not seem to be part of the current version of MinGW. Also, please clarify if you are actually doing this under cygwin, or if you added the tag by mistake.
Edit: A bit of googling seems like it has to do with the horrible "official" MinGW installation. Remove it, and download the Twilight Dragon build from http://tdm-gcc.tdragon.net and then rebuild completely. The "official" build is cr*p anyway - I don't know why anyone uses it.
If what you want to do is a stand alone application with MinGW, you should add -static to the linking options.
On a side note, if you're making a Win32 application, add the -mwindows option to the C++ compiler so it doesn't open a console together with your main window.