I have been trying to compile a windows 64 program, MSVAR1.3, on linux and have had problems with Linux and the headers that the program calls. The program calls for:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#ifdef __BORLANDC__
#include <float.h>
If I run the compile (using gcc in linux) and try to use the -I flag to tell it where the headers are, it doesn't get any better than if I run the compilation without headers at all. I have included some of the output below (I get almost 300 lines of unrecognized variables).
I have also tried running it with an -lm flag for the math library and this reduces the unrecognized errors, but if there are flags relating to libraries for the other headers, I haven't been able to find them. PLEASE HELP!!!!
(Errors from running using the -I flag:)
gcc msvar1.3.c -o msvar1.3 -lm/tmp/ccpZIkC1.o: In function `main':
msvar1.3.c:(.text+0x38): undefined reference to `opengfsr'
msvar1.3.c:(.text+0x927): undefined reference to `gfsr8'
msvar1.3.c:(.text+0x94c): undefined reference to `gfsr8'
msvar1.3.c:(.text+0x971): undefined reference to `gfsr8'
msvar1.3.c:(.text+0x9a2): undefined reference to `disrand'
msvar1.3.c:(.text+0x111a): undefined reference to `printerr'
msvar1.3.c:(.text+0x1809): undefined reference to `printerr'
msvar1.3.c:(.text+0x1ad2): undefined reference to `printerr'
msvar1.3.c:(.text+0x1be6): undefined reference to `gfsr8'
msvar1.3.c:(.text+0x2773): undefined reference to `closegfsr'
msvar1.3.c:(.text+0x2791): undefined reference to `closegfsr'
/tmp/ccpZIkC1.o: In function `treesummary':
msvar1.3.c:(.text+0x2808): undefined reference to `printerr'
/tmp/ccpZIkC1.o: In function `read_params':
msvar1.3.c:(.text+0x2b1f): undefined reference to `printerr'
msvar1.3.c:(.text+0x2b64): undefined reference to `printerr'
msvar1.3.c:(.text+0x2b72): undefined reference to `intrand'
msvar1.3.c:(.text+0x2bb7): undefined reference to `printerr'
msvar1.3.c:(.text+0x3000): undefined reference to `printerr'
msvar1.3.c:(.text+0x3063): undefined reference to `printerr'
msvar1.3.c:(.text+0x3077): undefined reference to `printerr'
/tmp/ccpZIkC1.o: In function `choosepar':
msvar1.3.c:(.text+0x36fb): undefined reference to `gfsr8'
msvar1.3.c:(.text+0x374b): undefined reference to `gfsr4'
msvar1.3.c:(.text+0x3799): undefined reference to `gfsr4'
msvar1.3.c:(.text+0x37b8): undefined reference to `norm4'
msvar1.3.c:(.text+0x37e5): undefined reference to `gfsr4'
msvar1.3.c:(.text+0x3826): undefined reference to `norm4'
msvar1.3.c:(.text+0x3853): undefined reference to `gfsr4'
msvar1.3.c:(.text+0x3894): undefined reference to `norm4'
msvar1.3.c:(.text+0x38f7): undefined reference to `norm4'
"undefined reference" errors are not from missing headers - they're linker errors indicating you don't link with an object, nor have a -l (minus ell) flag specifying a library, that exports these symbols. The headers only constitute a promise that variables and out-of-lines function matching the header declarations will be found in an object/library you provide at link time - you're breaking that promise.
You need to either find the libraries containing those symbols, or find the source and compile them.
I compiled msvar1.3 with command:
gcc -o msvar1.3 myutil.c msvar1.3.c -lm
Related
Trying to compile a third party library on MinGW in Code::Blocks on Lubuntu, and despite my absolute best efforts to eliminate the following undefined references which I've spent ages on, nothing is fixing the issues:
undefined reference to `_sfwgl_ext_EXT_swap_control
undefined reference to `_sfwgl_ext_ARB_pixel_format
undefined reference to `_sf_ptrc_wglChoosePixelFormatARB
undefined reference to `_sf_ptrc_wglGetPixelFormatAttribivARB
undefined reference to `_sfwgl_ext_ARB_multisample
undefined reference to `_sf_ptrc_wglGetPixelFormatAttribivARB
undefined reference to `_sfwgl_ext_ARB_pixel_format
undefined reference to `_sfwgl_ext_ARB_create_context
undefined reference to `_sfwgl_ext_ARB_create_context_profile
undefined reference to `_sf_ptrc_wglCreateContextAttribsARB
undefined reference to `_sf_ptrc_wglCreateContextAttribsARB
undefined reference to `_sf_ptrc_wglGetPixelFormatAttribivARB
undefined reference to `_sfwgl_ext_ARB_multisample
undefined reference to `_sf_ptrc_wglGetPixelFormatAttribivARB
undefined reference to `_sfwgl_LoadFunctions
From what I can tell is it's possibly some sort of missing GL library or graphics library, however I already have opengl32, gdi32, glu32, glut32 and gle added to the link library which has left the following undefined references untouched.
How do I fix the above errors?
[If it is a missing library or libraries, could I be linked to the download page for the appropriate headers and .a files for MinGW on linux? Thanks.]
I'm trying to make a PE (Portable Executable which will work with Windows XP+ and which has no dependencies.
I found this guide quite interesting http://www.catch22.net/tuts/reducing-executable-size
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
extern "C" int __cdecl __purecall(void)
{
return 0;
}
extern "C" int __cdecl main();
extern "C" int __cdecl mainCRTStartup( void )
{
int mainret;
mainret = main();
ExitProcess(mainret);
}
And I compile it with
g++ -Wall -o2 -s -nodefaultlibs main.cpp -o test.exe
And it's giving me a bunch of errors: http://i.stack.imgur.com/fIFoD.png
C:\Users\Main.cpp\Desktop\crt>g++ -Wall -o2 -s -nodefaultlibs -lkernel32 main.cpp -o test.exe
C:\Users\Main.cpp\AppData\Local\Temp\cczgOKUx.o:main.cpp:(.text+0x1c): multiple definition of `mainCRTStartup'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0x280): first defined here
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0x5): undefined reference to `__dyn_tls_init_callback'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0x39): undefined reference to `__cpu_features_init'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0x3e): undefined reference to `_fpreset'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0x4b): undefined reference to `_CRT_glob'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0x73): undefined reference to `__getmainargs'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0x78): undefined reference to `_CRT_fmode'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0x82): undefined reference to `_imp___iob'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0x87): undefined reference to `_fmode'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0x96): undefined reference to `_setmode'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0x9b): undefined reference to `_CRT_fmode'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0xaa): undefined reference to `_setmode'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0xaf): undefined reference to `_CRT_fmode'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0xbe): undefined reference to `_setmode'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0xc3): undefined reference to `__p__fmode'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0xc9): undefined reference to `_fmode'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0xd0): undefined reference to `_pei386_runtime_relocator'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0xd8): undefined reference to `__main'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0xdd): undefined reference to `__p__environ'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0x100): undefined reference to `_cexit'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0x13f): undefined reference to `signal'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0x195): undefined reference to `signal'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0x1d0): undefined reference to `signal'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0x217): undefined reference to `signal'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0x233): undefined reference to `signal'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0x250): more undefined references to `signal' follow
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0x266): undefined reference to `_fpreset'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0x28c): undefined reference to `_imp____set_app_type'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0x2ac): undefined reference to `_imp____set_app_type'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0x2c1): undefined reference to `_imp__atexit'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o:crt1.c:(.text+0x2d1): undefined reference to `_imp___onexit'
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../../mingw32/bin/ld.exe: C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../crt2.o: bad reloc address 0x20 in section `.eh_frame'
collect2.exe: error: ld returned 1 exit status
As far as I understood, my mainCRTStartup is interfering with another mainCRTStartup which my compiler is adding.
I'm using TDM-GCC on Windows.
After the suggestion to use -nostdlib instead of -nodefaultlibs I'm getting much less errors.
The ones I currently have are
C:\Users\Main.cpp\AppData\Local\Temp\ccMYa3VN.o:main.cpp:(.text+0x11): undefined reference to `__main'
C:\Users\Main.cpp\AppData\Local\Temp\ccMYa3VN.o:main.cpp:(.text+0x31): undefined reference to `ExitProcess#4'
GCC use some internal subroutines, contained in libgcc.a, that cannot be excluded.
See https://gcc.gnu.org/onlinedocs/gcc-5.3.0/gcc/Link-Options.html#Link-Options:
One of the standard libraries bypassed by -nostdlib and -nodefaultlibs
is libgcc.a, a library of internal subroutines which GCC uses to
overcome shortcomings of particular machines, or special needs for
some languages. (See Interfacing to GCC Output, for more discussion of
libgcc.a.) In most cases, you need libgcc.a even when you want to
avoid other standard libraries. In other words, when you specify
-nostdlib or -nodefaultlibs you should usually specify -lgcc as well. This ensures that you have no unresolved references to internal GCC
library subroutines.
P.S. The functions ExitProcess and SetUnhandledExceptionFilter are from kernel32.lib that you must include in linker stream. You can reduce libraries, but can't omit system and OS libraries.
My cpp file has Scilab and Octave header files. I'm trying to compile using this command
g++ -l:/usr/lib/scilab/libscilab.so -L/usr/lib/scilab -L/usr/lib/scilab -I/usr/include/octave-3.8.1 -I/usr/include/octave-3.8.1/octave -I/usr/include/scilab s_o_test_v4.cpp -o s_o_test_v4
I get the following error
s_o_test_v4.cpp:(.text+0x5f4): undefined reference to `pvApiCtx'
s_o_test_v4.cpp:(.text+0x5ff): undefined reference to `isVarMatrixType'
s_o_test_v4.cpp:(.text+0x61a): undefined reference to `pvApiCtx'
s_o_test_v4.cpp:(.text+0x644): undefined reference to `getMatrixOfDouble'
s_o_test_v4.cpp:(.text+0x743): undefined reference to `string_vector::c_str_vec() const'
s_o_test_v4.cpp:(.text+0x755): undefined reference to `octave_main'
s_o_test_v4.cpp:(.text+0x7a2): undefined reference to `octave_value::octave_value(double)'
s_o_test_v4.cpp:(.text+0x847): undefined reference to `feval(std::string const&, octave_value_list const&, int)'
s_o_test_v4.cpp:(.text+0x8a3): undefined reference to `pvApiCtx'
Both Scilab and Octave functions show error. Should I include or remove something from my compile command?
Maybe the ordering of your make command is wrong, see also
this SO question:
Please also note that libraries need to be specified on the command
line after the files needing them
That would make your command:
g++ -I/usr/include/octave-3.8.1 -I/usr/include/octave-3.8.1/octave -I/usr/include/scilab s_o_test_v4.cpp -o s_o_test_v4 -l:/usr/lib/scilab/libscilab.so -L/usr/lib/scilab -L/usr/lib/scilab
I've been trying to compile this OpenGL tutorial (originally purposed for Visual Studio) but I keep having 'undefined reference' errors. The compiler output is as follows:
Info: Internal Builder is used for build
g++ -o OpenGLTutorial.exe "src\\main.o" "src\\Camera.o" -lglew32 -lglu32 -lopengl32 -lfreeglut
src\main.o: In function `Z6InitGLiPPc':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:75: undefined reference to `glutInit'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:76: undefined reference to `glutSetOption'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:77: undefined reference to `glutGet'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:78: undefined reference to `glutGet'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:80: undefined reference to `glutInitDisplayMode'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:82: undefined reference to `glutInitContextVersion'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:83: undefined reference to `glutInitContextProfile'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:84: undefined reference to `glutInitContextFlags'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:86: undefined reference to `glutInitWindowPosition'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:87: undefined reference to `glutInitWindowSize'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:89: undefined reference to `glutCreateWindow'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:91: undefined reference to `glutIdleFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:92: undefined reference to `glutDisplayFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:93: undefined reference to `glutKeyboardFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:94: undefined reference to `glutKeyboardUpFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:95: undefined reference to `glutSpecialFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:96: undefined reference to `glutSpecialUpFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:97: undefined reference to `glutMouseFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:98: undefined reference to `glutMotionFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:99: undefined reference to `glutReshapeFunc'
src\main.o: In function `main':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:236: undefined reference to `glutMainLoop'
src\main.o: In function `Z9ReshapeGLii':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:249: undefined reference to `glutPostRedisplay'
src\main.o: In function `Z9DisplayGLv':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:262: undefined reference to `glutSwapBuffers'
src\main.o: In function `Z6IdleGLv':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:278: undefined reference to `glutPostRedisplay'
src\main.o: In function `Z10KeyboardGLhii':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:313: undefined reference to `glutLeaveMainLoop'
collect2.exe: error: ld returned 1 exit status
21:39:05 Build Finished (took 1s.154ms)
Can anyone tell me what is wrong?
If you need any more information to help answer the question just ask.
Edit (Some additional info):
As you can see from the compiler output I have linked the library that these functions require and the compiler does not complain that it could not find said library. Also I placed the freeglut dll into the binary folder.
This problem was apparently mainly due to user error and was completely circumstantial. I'm posting this for the people of the future who might have this problem.
In my header file I defined FREEGLUT_STATIC. After changing this to another variable, the linker no longer produced errors. Though I can't actually check -- very easily at least -- somewhere in my freeglut library this variable was used in an ifndef statement to determine whether freeglut needed to be linked (in case it was already linked).
I am new to boost and am trying to compile the most basic program that includes boost/asio/ssl.
I am working on ubuntu 13.10 64bit and installed the latest boost like this:
sudo apt-get install boost-all-dev
Here is the magnificent code I am trying to compile:
#include <stdio.h>
#include <boost/asio/ssl/stream.hpp>
int main(){
printf("Hi\n");
return 0;
}
I googled and googled and the few hints I was able to find suggests I use some boost library flags. So I did:
g++ my_prog.cpp -o my_prog.bin -lboost_system -lboost_thread -lpthread
and all the time I get the same error message (no matter how many -l i shove in):
/tmp/cci6dJdZ.o: In function `boost::asio::ssl::detail::openssl_init_base::do_init::do_init()':
my_prog.cpp:(.text._ZN5boost4asio3ssl6detail17openssl_init_base7do_initC2Ev[_ZN5boost4asio3ssl6detail17openssl_init_base7do_initC5Ev]+0x2c): undefined reference to `SSL_library_init'
my_prog.cpp:(.text._ZN5boost4asio3ssl6detail17openssl_init_base7do_initC2Ev[_ZN5boost4asio3ssl6detail17openssl_init_base7do_initC5Ev]+0x31): undefined reference to `SSL_load_error_strings'
my_prog.cpp:(.text._ZN5boost4asio3ssl6detail17openssl_init_base7do_initC2Ev[_ZN5boost4asio3ssl6detail17openssl_init_base7do_initC5Ev]+0x36): undefined reference to `OPENSSL_add_all_algorithms_noconf'
my_prog.cpp:(.text._ZN5boost4asio3ssl6detail17openssl_init_base7do_initC2Ev[_ZN5boost4asio3ssl6detail17openssl_init_base7do_initC5Ev]+0x47): undefined reference to `CRYPTO_num_locks'
my_prog.cpp:(.text._ZN5boost4asio3ssl6detail17openssl_init_base7do_initC2Ev[_ZN5boost4asio3ssl6detail17openssl_init_base7do_initC5Ev]+0xcc): undefined reference to `CRYPTO_set_locking_callback'
my_prog.cpp:(.text._ZN5boost4asio3ssl6detail17openssl_init_base7do_initC2Ev[_ZN5boost4asio3ssl6detail17openssl_init_base7do_initC5Ev]+0xd6): undefined reference to `CRYPTO_set_id_callback'
/tmp/cci6dJdZ.o: In function `boost::asio::ssl::detail::openssl_init_base::do_init::~do_init()':
my_prog.cpp:(.text._ZN5boost4asio3ssl6detail17openssl_init_base7do_initD2Ev[_ZN5boost4asio3ssl6detail17openssl_init_base7do_initD5Ev]+0x13): undefined reference to `CRYPTO_set_id_callback'
my_prog.cpp:(.text._ZN5boost4asio3ssl6detail17openssl_init_base7do_initD2Ev[_ZN5boost4asio3ssl6detail17openssl_init_base7do_initD5Ev]+0x1d): undefined reference to `CRYPTO_set_locking_callback'
my_prog.cpp:(.text._ZN5boost4asio3ssl6detail17openssl_init_base7do_initD2Ev[_ZN5boost4asio3ssl6detail17openssl_init_base7do_initD5Ev]+0x22): undefined reference to `ERR_free_strings'
my_prog.cpp:(.text._ZN5boost4asio3ssl6detail17openssl_init_base7do_initD2Ev[_ZN5boost4asio3ssl6detail17openssl_init_base7do_initD5Ev]+0x2c): undefined reference to `ERR_remove_state'
my_prog.cpp:(.text._ZN5boost4asio3ssl6detail17openssl_init_base7do_initD2Ev[_ZN5boost4asio3ssl6detail17openssl_init_base7do_initD5Ev]+0x31): undefined reference to `EVP_cleanup'
my_prog.cpp:(.text._ZN5boost4asio3ssl6detail17openssl_init_base7do_initD2Ev[_ZN5boost4asio3ssl6detail17openssl_init_base7do_initD5Ev]+0x36): undefined reference to `CRYPTO_cleanup_all_ex_data'
my_prog.cpp:(.text._ZN5boost4asio3ssl6detail17openssl_init_base7do_initD2Ev[_ZN5boost4asio3ssl6detail17openssl_init_base7do_initD5Ev]+0x40): undefined reference to `CONF_modules_unload'
my_prog.cpp:(.text._ZN5boost4asio3ssl6detail17openssl_init_base7do_initD2Ev[_ZN5boost4asio3ssl6detail17openssl_init_base7do_initD5Ev]+0x45): undefined reference to `ENGINE_cleanup'
/tmp/cci6dJdZ.o: In function `boost::asio::error::detail::ssl_category::message(int) const':
my_prog.cpp:(.text._ZNK5boost4asio5error6detail12ssl_category7messageEi[_ZNK5boost4asio5error6detail12ssl_category7messageEi]+0x1d): undefined reference to `ERR_reason_error_string'
collect2: error: ld returned 1 exit status
Or in short: it complaining about missing symbols like:
undefined reference to `SSL_library_init'
or:
undefined reference to `ERR_reason_error_string'.
Another funny fact is that if I change the include:
#include <boost/asio/ssl/stream.hpp>
for example to
#include <boost/asio/ssl/stream_base.hpp>
it compiles just fine (even without -lboost_system and all others..).
I spent a whole day on this and still can't for the life of me figure this out.
Any ideas guys?
In vs2013, when I include <boost/asio/ssl.hpp> I see
unresolved external symbol _CONF_modules_upload
unresolved external symbol _ERR_reason_error_string
I solved those issues by adding
libcrypto32MD.lib
in Linker/Additional Dependencies