Installing and working with FLTK on Visual Studio 2012 - c++

My machine in Windows 7 32-bit and my compiler for C++ is Visual Studio 2012 so first I downloaded FLTK from here (http://www.stroustrup.com/Programming/FLTK/) and then I did the works as follows has wanted me:
I. Unzip the downloaded file and open the main folder, fltk-l.l.? In a
Visual C++ folder (e.g., vc2005 or vcnet), open fltk.dsw. If asked about
updating old project files, choose Yes to All.
PS: My compiler is vc2012 instead of vc2005 and there wasn't any file named fltk.dsw in vc2005 or vcnet folders, so I chose the fltk.sln from vcnet and installed it. There were some failing when installing but it finished finally!
From the Build menu, choose Build Solution. This may take a few minutes.
The source code is being compiled into static link libraries so that
you do not have to recompile the FLTK source code any time you make
a new project. When the process has finished , close Visual Studio.
From the main FLTK directory open the lib folder. Copy (not just
move/drag) all the .lib files except README.lib (there should be
scven) into C:\Prograrn Files\Microsoft Visual Studio\Vc\lib.
Go back to the FLTK main directory and copy the FL folder into
C:\Program Files\Microsoft Visual Studio\Vc\include.
Create a new project in Visual Studio with one change to the usual procedure:
create a "\Vin32 project" instead of a "console application" when
choosing your project type. Be sure to create an "empty project"; otherwise,
some "software wizard" will add a lot of stuff to your project that
you are unlikely to need or understand.
In Visual Studio, choose Project from the main (top) menu, and from
the drop-down menu choose Properties.
In the Properties dialog box, in the left menu, click the Linker folder.
This expands a sub-menu. In this sub-menu, click Input. In the Additional
Dependencies text field on the right, enter the following text:
fltkd.lib wsock32.lib comctl32.lib fltkjpegd.lib fltkimagesd.lib
[The following step may be lIImecessary because il is now the default.]
In the Ignore Specific Library text field, enter the following text:
libcd.lib
[This step may be unnecessary because /MDd is now the default.] In the
left menu of the same Properties window, dick C/C++ to expand a different
sub-menu. Click the Code Generation sub-menu item. In the right
menu, change the Runtime Library drop-down to Multi-threaded
Debug DLL (/MDd). Click OK to close the Properties window.
I this step I added a new item to that newly created project (I named that project testv.cpp) and pasted this simple code for testing the FLTK:
#include <FL/Fl.h>
#include <FL/Fl_box.h>
#include <FL/Fl_Window.h>
//***************************
int main()
{
FI_Window window(200, 200, "Window title");
FL_Box box(O,O,200,200, "Hey, I mean, He llo, World! ");
window.show();
return Fl::run();
}
After running this project (pressing F5), 11 errors appeared! They are in bellow:
Error 1 error LNK2019: unresolved external symbol "public: static int
__cdecl Fl::run(void)" (?run#Fl##SAHXZ) referenced in function _main C:\Users\CS\documents\visual studio 2012\Projects\testv\testv\testv.obj
Error 2 error LNK2019: unresolved external symbol "protected:
__thiscall Fl_Widget::Fl_Widget(int,int,int,int,char const *)" (??0Fl_Widget##IAE#HHHHPBD#Z) referenced in function "public:
__thiscall Fl_Box::Fl_Box(int,int,int,int,char const *)" (??0Fl_Box##QAE#HHHHPBD#Z) C:\Users\CS\documents\visual studio
2012\Projects\testv\testv\testv.obj
Error 3 error LNK2019: unresolved external symbol "public: virtual
__thiscall Fl_Widget::~Fl_Widget(void)" (??1Fl_Widget##UAE#XZ) referenced in function "public: virtual __thiscall
Fl_Box::~Fl_Box(void)"
(??1Fl_Box##UAE#XZ) C:\Users\CS\documents\visual studio
2012\Projects\testv\testv\testv.obj
Error 4 error LNK2001: unresolved external symbol "public: virtual
void __thiscall Fl_Widget::resize(int,int,int,int)"
(?resize#Fl_Widget##UAEXHHHH#Z) C:\Users\CS\documents\visual studio
2012\Projects\testv\testv\testv.obj
Error 5 error LNK2001: unresolved external symbol "protected: virtual
void __thiscall Fl_Box::draw(void)"
(?draw#Fl_Box##MAEXXZ) C:\Users\CS\documents\visual studio
2012\Projects\testv\testv\testv.obj
Error 6 error LNK2001: unresolved external symbol "public: virtual int
__thiscall Fl_Box::handle(int)" (?handle#Fl_Box##UAEHH#Z) C:\Users\CS\documents\visual studio
2012\Projects\testv\testv\testv.obj
Error 7 error LNK2019: unresolved external symbol "public: __thiscall
Fl_Window::Fl_Window(int,int,char const *)"
(??0Fl_Window##QAE#HHPBD#Z) referenced in function
_main C:\Users\CS\documents\visual studio 2012\Projects\testv\testv\testv.obj
Error 8 error LNK2019: unresolved external symbol "public: virtual
__thiscall Fl_Window::~Fl_Window(void)" (??1Fl_Window##UAE#XZ) referenced in function _main C:\Users\CS\documents\visual studio
2012\Projects\testv\testv\testv.obj
Error 9 error LNK2019: unresolved external symbol "public: virtual
void __thiscall Fl_Window::show(void)" (?show#Fl_Window##UAEXXZ)
referenced in function _main C:\Users\CS\documents\visual studio
2012\Projects\testv\testv\testv.obj
Error 10 error LNK2019: unresolved external symbol WinMain#16
referenced in function __tmainCRTStartup C:\Users\CS\documents\visual
studio 2012\Projects\testv\testv\MSVCRTD.lib(crtexew.obj)
Error 11 error LNK1120: 10 unresolved
externals C:\Users\CS\documents\visual studio
2012\Projects\testv\Debug\testv.exe
I think the problem is to do with the creating the project. After I created an empty project from Win32 Project I clicked on Add new item and chose the .cpp type. I don't know was it correct or not.
Any idea for fixing the problem?

You are getting that error because you are entering all the library names on one line without a separator. It is taking the whole list as one library. Click on the ellipsis then enter each library name separated by a newline.
Instead of wsock32.lib, use ws2_32.lib

You are getting that error because you are entering all the library
names on one line without a separator. It is taking the whole list as
one library. Click on the ellipsis then enter each library name
separated by a newline.
Instead of wsock32.lib, use ws2_32.lib
Just to add. To Separate each library, put a semicolon after each library name (ex. libraryname.lib; libraryname.lib) or just press enter on the text box to go to the next line so Visual Studio will read it as next line and anything you enter to it will consider it as a library name.
Example:
libraryname.lib - Now, press enter so it will go to the next line, VS will recognize at a library name.
libraryname.lib - This is the next line and your new library
I am studying C++ and using Microsoft Visual Studio 2015 ^_^

Related

Many errors happened when building ACE and TAO (CORBA) using VS 2010

I'm trying to build ACE and TAO environment but got many errors.
The procedure what I did to install ACE and TAO is:
Unzip the file (ACE+TAO+CIAO-6.1.2.zip) into the folder (C:\ACE_wrappers)
Create a config.h file in C:\ACE_wrappers\ace
Open the config.h file and type in lines:
#definenter code heree ACE_HAS_WINNT4 1
#define ACE_HAS_STANDARD_CPP_LIBRARY 1
#define ACE_HAS_MFC 1
#define THR_USE_AFX 1
#define ACE_USES_STATIC_MFC 1
#define ACE_AS_STATIC_LIBS 1
#define ACE_NO_INLINE
#include "ace/config-win32.h"
Saved it and close
Open Control Panel - > System -> Advanced system settings -> Environment Variables
Create a new system variable: ACE_ROOT, value: C:\ACE_wrappers
Create a new system variable: TAO_ROOT, value: C:\ACE_wrappers\TAO
In PATH system variable, add value: C:\Program Files\Microsoft Visual Studio 10.0\VC\bin;C:\ACE_wrappers\bin;C:\ACE_wrappers\lib;C:\ACE_wrappers\TAO\bin;
so the value is:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;%USERPROFILE%.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft Visual Studio 10.0\VC\bin;C:\ACE_wrappers\bin;C:\ACE_wrappers\lib;C:\ACE_wrappers\TAO\bin;
Start Visual Stiduo 2010
Open TAO_ACE_vc10.sln solution in C:\ACE_wrappers\TAO
Select Release in solution configuration (on the menu bar)
Select all project and right-click then choose Properties
Set Configuration Properties -> General -> Use of MFC to Use MFC in a Shared DLL
In Configuration Properties -> VC++ Directories -> Executable Directories add C:\ACE_wrappers\bin;
In Configuration Properties -> VC++ Directories -> Include Directories add C:\ACE_wrappers
C:\ACE_wrappers\TAO
C:\ACE_wrappers\TAO\tao
C:\ACE_wrappers\TAO\orbsvcs
C:\ACE_wrappers\TAO\orbsvcs\orbsvcs
In Configuration Properties -> VC++ Directories -> Library Directories add
C:\ACE_wrappers\ace
C:\ACE_wrappers\TAO\tao
C:\ACE_wrappers\TAO\orbsvcs\orbsvcs
Select every project and check whether its Configuration Properties -> General -> Configuration Type is Dynamic Library (.dll), if it is, then change to Static library (.lib)
But if it is Application(.exe) or Utility, then I do not change. Like the Scheduling_Service project which has error during build.
Build -> Build Solution
After a long time, most projects are built successfully. The Scheduling_Service, Time_Service_Clerk, NT_Notify_Service, Naming_Service (, and maybe there are few other projects) have errors (error LNK2001: unresolved external symbol "__declspec(dllimport) public:......).
1>Scheduling_Service.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall TAO_ORB_Manager::~TAO_ORB_Manager(void)" (__imp_??1TAO_ORB_Manager##QAE#XZ) referenced in function __unwindfunclet$??0TAO_Scheduling_Service##QAE#XZ$0
1>Scheduling_Service.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall TAO_ORB_Manager::TAO_ORB_Manager(class CORBA::ORB *,class PortableServer::POA *,class PortableServer::POAManager *)" (__imp_??0TAO_ORB_Manager##QAE#PAVORB#CORBA##PAVPOA#PortableServer##PAVPOAManager#4##Z) referenced in function "public: __thiscall TAO_Scheduling_Service::TAO_Scheduling_Service(void)" (??0TAO_Scheduling_Service##QAE#XZ)
1>Scheduling_Service.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall CosNaming::Name::~Name(void)" (__imp_??1Name#CosNaming##UAE#XZ) referenced in function "public: int __thiscall TAO_Scheduling_Service::init(int,char * * const)" (?init#TAO_Scheduling_Service##QAEHHQAPAD#Z)
1>TAO_RTSchedd.lib(Scheduler_Factory.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall CosNaming::Name::~Name(void)" (__imp_??1Name#CosNaming##UAE#XZ)
1>Scheduling_Service.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: struct CosNaming::NameComponent & __thiscall TAO::unbounded_value_sequence::operator[](unsigned int)" (__imp_??A?$unbounded_value_sequence#UNameComponent#CosNaming###TAO##QAEAAUNameComponent#CosNaming##I#Z) referenced in function "public: int __thiscall TAO_Scheduling_Service::init(int,char * * const)" (?init#TAO_Scheduling_Service##QAEHHQAPAD#Z)
1>TAO_RTSchedd.lib(Scheduler_Factory.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct CosNaming::NameComponent & __thiscall TAO::unbounded_value_sequence::operator[](unsigned int)" (__imp_??A?$unbounded_value_sequence#UNameComponent#CosNaming###TAO##QAEAAUNameComponent#CosNaming##I#Z)
Does anyone know this problem? Thank you very much.
You shouldn't use #define ACE_AS_STATIC_LIBS 1 unless you are using a Visual Studio project which are generated for static usage. At the moment you want to do a static build you have to regenerate the Visual Studio projects with MPC

Opus Undefined reference while linking on Window

After 4 hours of search, I cannot understand why there are some unresovled external symbal error while I link the library.
I'm using VS 2015.
Severity Code Description Project File Line
Error LNK2019 unresolved external symbol _opus_encoder_create referenced in function "public: __thiscall Compressor::Compressor(int,int)" (??0Compressor##QAE#HH#Z) PortOpus A:\sharedfolder\babel\client\Compressor.obj 1
I would like to know, why ? Plus I'm sure that the lib got these functions, as I've opened it with atom and ctrl+f the name.

cannot open file 'LIBC.lib'

I changed a workspace developed in VC 6.0 to VS 2008. When I tried to build the workspace I am getting the following error message. How can I correct the problem?
fatal error LNK1104: cannot open file 'LIBC.lib'
I am getting the following messages when I ignored libc.lib
Error 1 error LNK2019: unresolved external symbol "__declspec(dllimport) class CIHoTSimEngine * __cdecl CreateHoTSimEngine(void)" (__imp_?CreateHoTSimEngine##YAPAVCIHoTSimEngine##XZ) referenced in function "private: int __thiscall CHoTSimV2Doc::Init(void)" (?Init#CHoTSimV2Doc##AAEHXZ) HoTSimV2Doc.obj HoTSimV2
Error 2 error LNK2019: unresolved external symbol "__declspec(dllimport) class CIFABConnect * __cdecl CreateFabConnectServer(void)" (__imp_?CreateFabConnectServer##YAPAVCIFABConnect##XZ) referenced in function "private: int __thiscall CHoTSimV2Doc::Init(void)" (?Init#CHoTSimV2Doc##AAEHXZ) HoTSimV2Doc.obj HoTSimV2
Error 3 fatal error LNK1120: 2 unresolved externals D:\Projects\AsWorxSim\Bin\Release\HoTSim2.0.exe 1 HoTSimV2
Project Property -> Configuation Properties -> Linker -> Input -> Ignore Specific Library
Ignore the LIBC.LIB
Edit: I think once you remove the LIBC.lib as mentioned above, you are moving ahead with your linking and getting errors which exist in your app. You should try to look in these errors now. Think about it, if libc.lib was missing in the first place then how could it provide any linkage which seems to have appeared after you ignored it.
Command line option:
cl source.cpp /link /NODEFAULTLIB:LIBC.LIB
look here:
Discussion about libc on microsoft forum that's for vs2005 but for 2008 it is the same...
You need to "Rebuild All", to make sure you don't have any .obj files from VC6 hanging around.

Help on jrtplib and jthread

I have some link error problems when trying to compile using jrtplib and jthread on my simple project. The errors are:
Error 4 fatal error LNK1120: 3 unresolved externals C:\Users\Chicko\Desktop\tryout\Debug\tryout.exe
Error 1 error LNK2019: unresolved external symbol "public: virtual __thiscall RTPSession::~RTPSession(void)" (??1RTPSession##UAE#XZ) referenced in function _wmain tryout.obj
Error 2 error LNK2019: unresolved external symbol "public: __thiscall RTPSessionParams::RTPSessionParams(void)" (??0RTPSessionParams##QAE#XZ) referenced in function _wmain tryout.obj
Error 3 error LNK2019: unresolved external symbol "public: __thiscall RTPSession::RTPSession(class RTPRandom *,class RTPMemoryManager *)" (??0RTPSession##QAE#PAVRTPRandom##PAVRTPMemoryManager###Z) referenced in function _wmain tryout.obj
and here is my main program:
// tryout.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <rtpsession.h> //Confused to put "" or <>
#include <rtpsessionparams.h>
#include <rtpudpv4transmitter.h>
int _tmain(int argc, _TCHAR* argv[])
{
RTPSession session;
RTPSessionParams sessionparams;
RTPUDPv4TransmissionParams transparams;
sessionparams.SetOwnTimestampUnit(1.0/8000.0);
transparams.SetPortbase(8000);
return 0;
}
For your information, I do not import any header file from those libraries into my project. I use additional include libraries in the project setting and put `"..\jlib\jthread-1.2.1\src";"..\jlib\jrtplib3.8.2\src" (this is the folder where all the headers are stored). How do I fix this? Where should i put jrtplib.lib and jthread.lib? Please help...
Have you added jrtplib.lib and jthread.lib under your project linker options?
You can do this on the project property page under
"Configuration properties->Linker->Input->Additional Dependencies" and make sure that the directory that contains the lib files has been added to your library path: Either on the project properties
"Linker->General->Additional Library Directories"
or under the global VS settings (Doesn't apply to VC2010)
"Tools->Options" "Projects and Solutions->VC++ Directories->Library Files"
Under VC2010 you'll have to edit the property sheet of the project.
I see that it's a bit late to answer and I'm not so expert on Windows (I'm more a Linux user), but some day ago I've tried JRTPLIB on Windows and I had the same problem when I compiled the example in release mode and the lib in debug mode (I see that you use the debug mode). Hope it can help.

fftw in Visual Studio?

I'm trying to link my project with fftw and so far, I've gotten it to compile, but not link. As the site said, I generated all the .lib files (even though I'm only using double precision), and copied them to C:\Program Files\Microsoft Visual Studio 9.0\VC\lib, the .h file to C:\Program Files\Microsoft Visual Studio 9.0\VC\include and the .dll to C:\windows\system32.
I've copied the tutorial program, and the exact error I am getting is:
1>hw10.obj : error LNK2019: unresolved external symbol __imp__fftw_free referenced in function "bool __cdecl test(void)" (?test##YA_NXZ)
1>hw10.obj : error LNK2019: unresolved external symbol __imp__fftw_destroy_plan referenced in function "bool __cdecl test(void)" (?test##YA_NXZ)
1>hw10.obj : error LNK2019: unresolved external symbol __imp__fftw_execute referenced in function "bool __cdecl test(void)" (?test##YA_NXZ)
1>hw10.obj : error LNK2019: unresolved external symbol __imp__fftw_plan_dft_1d referenced in function "bool __cdecl test(void)" (?test##YA_NXZ)
1>hw10.obj : error LNK2019: unresolved external symbol __imp__fftw_malloc referenced in function "bool __cdecl test(void)" (?test##YA_NXZ)
So, what could be wrong with my project setup? Thanks!
My case
Using FFTW in Visual Studio 2010
Precompiled FFTW 3.3.1 Windows DLLs install using fftw-3.2.1-dll.zip, on my Windows XP machine.
Open cmd window and go to lib.exe folder C:\Program Files\Microsoft Visual Studio 10.0\VC\bin>
Type lib /def:libfftw3-3.def
Type lib /def:libfftw3f-3.def
Type lib /def:libfftw3l-3.def
If you have a error on command, copy any mspdb80.dll or mspdb100.dll file to in bin directory.
You will get 6 files
libfftw3-3.exp, libfftw3-3.lib, libfftw3f-3.exp, libfftw3f-3.lib,
libfftw3l-3.exp and libfftw3l-3.lib
and copy it to programming directory.
Delete all mspdb80.dll or mspdb100.dll file from bin directory.
Closed Project and open again and rebuild it again.
Have you actually linked against the library in the project you're building?
Project -> Properties -> Linker -> Input -> Additional dependencies
You need to add the library's filename to that field.
Assuming you've actually linked your project against the lib and it doesn't work, use /verbose:lib and paste the output of that and the output of
dumpbin /exports fftw.lib | findstr fftw_free
I had similar problem. What helped was compiling the fftw libs with this help Compiling FFTW source in Visual studio. Actually more closely the problem was compiling my application Win 32 and trying to use x64 -libraries. So make sure the platform is same.