Hello Community

Today I wanted to build Win32 console project for example1.cpp under VS2008 envrionment without JAM utility. I followed the steps described by BuildingGPSTkUnderWindows as following

a) Installed Regex support 2.7 under C:\Proram Myfiles\GNUWin32

b) add path, include and lib of "regex" in envoirnment variables of windows XP.

c) create the project and added the command line with all include directories in project properties

Then I build the project(example1.cpp) and got following Linking errors:

======= ERRORS==================

>/OUT:"Debug/GPSTK.exe" /INCREMENTAL /NOLOGO /LIBPATH:"C:\Program Files\GnuWin32\lib" /DEBUG /PDB:"Debug/GPSTK.pdb" /SUBSYSTEM:CONSOLE /MACHINE:X86 regex.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib "\Program Files\GnuWin32\lib\regex.lib"







“link.exe @c:\gpstk\Gpstk\Debug\RSP000019.rsp”

Output Window


CommandOptionParser.obj: error LNK2001: unresolved external symbol_optarg;

CommandOptionParser.obj: error LNK2001: unresolved external symbol_optopt

CommandOptionParser.obj: error LNK2019: unresolved external symbol_getopt_long

CommandOptionParser.obj: error LNK2001: unresolved external symbol_optind

CommandOptionParser.obj: error LNK2001: unresolved external symbol_opterr

Debug/GPSTK.exe: fatal error LNK1120: 5 unresolved externals

GPSTK - 6 errors 0 warnings

I couldn't find the reason for the problem through I have done lots of tests on link of "regex.lib".

It might be due to two reasons

1) "regex.h" wasn't set correctly.

I have tried lots different way to test it, e.g. C:\echo %PATH", C:\echo %LIB%, C:\echo %include% I could see that my setting for regex.h is in envrionment variables.

2) The download "regex.lib" in fact might not work for for my case.

But I don't know how to build a proper "regex.lib"

Any suggestion will be appreciated


-- QiangZhang - 13 Feb 2011


ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

Hi QiangZhang!

I do not think the link errors you are seeing are due to regex. It is due to the absence of getopt in the MS compiler. You could try including getopt1.c into your project - maybe this will clear up all the problems.

As you know, this dependency, as well as the regex dependency, is taken care of by Jam. However I feel that many users like yourself will want to build the project without Jam. Historically, my experience with projects and IDEs is that they make too many binary files that have hard coded paths in them. So they can't be redistributed successfully. Is it possible to create a project file for the MS compiler that can be redistributed? That is, one that does not have hard coded drive dependencies? Please let us know what you think about that.

-- BenHarris - 14 Feb 2011

Thanks BenHarris

It did work while I included getopt1.c and getopt.h in my project previously.

Thanks again, I will try some more examples.



-- QiangZhang - 14 Feb 2011 No such template def TMPL:DEF{PROMPT:supportquery}
Topic revision: r4 - 12 Jun 2015, UnknownUser

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback