installing FLTK 1.3.2 on microsoft visual 2010 - c++

I'm getting this linker error when I try to compile the hello world .cpp after installing the FLTK kit.If you notice the library names are from installation found in appendix D in the stroustrup book "programming principles and practice". The edition is 2012 but it seems that FLTK version is a bit different now, for instance the version the book recommends to down load is FLTK 1.1.(?), and 1.3.2 is the latest. I think the linker problem is inside my VC++ project under the project/properties/linker/input/additional dependencies tab I put (per appendix d)
fltk.lib
wsock32.lib
comctl32.lib
fltkjpegd.lib
fltkimagesd.lib
But the .lib files I copied from the fltk lib folder didn't have those names. They are named:
fltkzlibd
fltkpngd
fltkjpegd
fltkimagesd
fltkformsd
fltkgld
fltkd
Are these the .lib files to include in VC++ project under the project/properties/linker/input/additional dependencies tab ? If not, how else can I fix this mess?
1>------ Build started: Project: test, Configuration: Debug Win32 ------
1> test.cpp
1>LINK : fatal error LNK1104: cannot open file 'fltk.lib wsock32.lib comctl32.lib fltkjpegd.lib fltkimagesd.lib'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>
int main(int argc, char **argv)
{
Fl_Window *window = new Fl_Window(300,180);
Fl_Box *box = new Fl_Box(20,40,260,100,"Hello, World!");
box->box(FL_UP_BOX);
box->labelsize(36);
box->labelfont(FL_BOLD+FL_ITALIC);
box->labeltype(FL_SHADOW_LABEL);
window->end();
window->show(argc, argv);
return Fl::run();
}

Include those lib files for the debug version. The release versions don't have the trailing d.
For the linking, use ws2_32.lib instead of wsock32.lib.
When adding your additional dependencies, did you click on the ellipsis and then in the dialog enter all the library names on one line? They need to be entered on separate lines.

Related

Can not open file "fltkd.lib" error in Visual Studio 2019

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>
int main()
{
FI_Window window(200, 200, "Window title"); // error: FI
FL_Box box(0, 0, 200, 200, "Hey, I mean, Hello, World! ");
window.show();
return Fl::run();
}
I build the above code in VS 2019 and and get an error code LNK1104 | Can not open file "fltkd.lib". I have all the linker settings/values checked as suggested in the book Programming Principles and Practices using C++ by Bjarne Stroustrup and other online sources but still I am getting the error. Is there some different settings with VS 2019 or am I putting the libs file in the wrong directries.
Directory where I put the libs files:-
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\lib
LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
If you compiled one file to use one kind of run-time library and another file to use another kind (for example, debug versus retail) and tried to link them, you will get this warning. You should compile all source files to use the same run-time library.
Project -> Properties -> C/C++ -> Code Generation -> Runtime Library
There are 4 versions of the CRT link libraries present in vc\lib:
libcmt.lib: static CRT link library for a release build (/MT)
libcmtd.lib: static CRT link library for a debug build (/MTd)
msvcrt.lib: import library for the release DLL version of the CRT (/MD)
msvcrtd.lib: import library for the debug DLL version of the CRT (/MDd)
According to the Doc:Linker Tools Warning LNK4098
when your executable uses the multi-threaded, non-debug run-time libraries, the list reported should include LIBCMT.lib, and not LIBCMTD.lib, MSVCRT.lib, or MSVCRTD.lib. You can tell the linker to ignore the incorrect run-time libraries by using /NODEFAULTLIB for each library you want to ignore.

Cannot open file 'sfml-graphicsd.lib'

I have recently picked up the book Beginning C++ Game Programming. I am following the book as precise as I can. I am a Java dev with about 2 years experience who is looking to pick up C++. I thought it would be fun learning it while learning game programming.
So I am getting the error 1>LINK : fatal error LNK1104: cannot open file 'sfml-graphicsd.lib'. I have added the include to the file, I have added the additional include and libs in the C++, Linker and Debug project properties. I will include the code, there is nothing yet I just wanted to see the window that is being created but already getting compiler errors.
I have noticed that the actual file name is sfml-graphics-d.lib whereas the compiler seems to be trying to open sfml-graphicsd.lib. I have checked the version of SFML that I downloaded and it is Visual C++ 14 (2015) - 32-bit and I am compiling win32.
Code:
// Samurai.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <SFML\Graphics.hpp>
using namespace sf;
int main()
{
VideoMode vm(1920, 1080);
Window(vm, "Samurai", Style::Fullscreen);
return 0;
}
Output:
1>------ Build started: Project: Samurai, Configuration: Debug Win32 ------
1>LINK : fatal error LNK1104: cannot open file 'sfml-graphicsd.lib'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Please let me know if any further information is required.
Thank you all so much,
Owen
I found the error. It was a spelling mistake in the properties > debugs > linker > input there was no - in the dll filenames

How does visual studio (ms compiler) know it needs specific boost libraries

vs2015 community, x64, debug, boost 1.63
New Empty project
Properties->C++->General->Additional Include Directories add
"C:\Program Files\boost_1_63_0" Add new C++ file, Source.cpp:
#include "boost/make_shared.hpp"
#include "boost/thread.hpp"
void main(int argc, char **argv)
{
}
Build Solution
Result:
1>------ Build started: Project: boostLibTest, Configuration: Debug x64 ------
1> Source.cpp
1>LINK : fatal error LNK1104: cannot open file 'libboost_thread-vc140-mt-gd-1_63.lib'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Where is that lib file getting added to the project? It's not boostLibTest.vcxproj, nor the command line for the compiler.
I wanted to write a static library that uses boost that I can access from another app that doesn't have/need boost, but this auto-include-boost-dependency prevents me from doing so.
There are #pragmas that MSVC supports that let a header file state "you need this library".
Boost is apparently using them.
Ideally, boost should only include them in header files that are not "header only". The granularity may not be perfect. But if you only need some enum values and other header-file only data from "boost/thread.hpp", check to see if they are included in a "header-file-only" header.

LINK : fatal error LNK1104: cannot open file 'opencv_calib3d245d.lib' (OpenCV 2.4.9)

I'm using OpenCV 2.4.9 in Windows 7 with Visual Studio C++ 2010 Express.
I downloaded the OpenCV 2.4.9 and did the installation process according to this tutorial. Including set the environment variables.
http://opencv-srf.blogspot.com.br/2013/05/installing-configuring-opencv-with-vs.html
Except for the version of compiler, instead of "vc11" (like in the tutorial) I put "vc10".
Well, the rest I did exactly like in this tutorial.
I'm trying to run this simple code:
#include <stdio.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
int main ( int argc, char **argv ) {
Mat image = imread("9-002.tif", CV_LOAD_IMAGE_GRAYSCALE);
adaptiveThreshold(image, image, 255, ADAPTIVE_THRESH_MEAN_C, THRESH_BINARY_INV, 111, -20);
imwrite("rs_9-002.tif", image);
return 0;
}
And when I run the project I get this:
1>------ Build started: Project: Projeto de TESTES, Configuration: Debug Win32 ------
1> main.cpp
1>LINK : fatal error LNK1104: cannot open file 'opencv_calib3d245d.lib'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
the properties of my project are as follows:
I do not know how to fix this. Any idea what could be causing this error?
Looking at your Additional Dependencies you have listed libraries for opencv-2.4.5 not opencv-2.4.9. The libraries in your Additional Dependencies are named *245d.lib not *249d.lib. You will need to edit all the entries that have 245 in the library name and replace that with 249. Make sure you do that for all the configurations you use (Debug, Release ...).

Cannot open include file X11/X.h when compiling

I've copied the FL folder into the project.
and it show me this:
1>------ Build started: Project: Client, Configuration: Debug Win32
------ 1> Main.cpp 1>c:\users\user\documents\visual studio 2012\projects\talktome\talktome\fl\xutf8.h(33): fatal error C1083:
Cannot open include file: 'X11/X.h': No such file or directory
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
my source code is
using namespace std;
#include "FL\Fl.H"
#include "FL\Fl_Window.H"
#define WIDTH 700
#define HEIGHT 500
int main()
{
Fl_Window win(WIDTH, HEIGHT, "TalkToMe");
win.begin();
win.end();
win.show();
return Fl::run();
}
You should check if there is "#define WIN32" before your FLTK includes. will help you. It should. Simular problem here:
FLTK in MSVC needs x11 headers?
Do not use the \ in the include statements. Use the forward slash / .
The problems you refer to in your comment to Mycotoxin clearly indicate you have linking problems. You have to tell your compiler where to find the fltk library and the header files. Unresolved external symbols mean only one thing you know... :)
You do not have to define WIN32 as described in Mycotoxin's text. The compiler does that for you, and FLTK uses this fact. Even if it does not, you typically give it as a parameter to the compiler (something like -DWIN32 in the case of GCC or similar for CL).
Watch Greg's video tutorial at http://seriss.com/people/erco/fltk-videos/ where he explains how to configure FLTK and build a small app using Microsoft Visual Studio 7.
Finally, get the source package, and read the README.MSWindows.txt file. It explains everything you need to know in order to build your FLTK-based application on Windows.