Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Quote:
Hello, my name is Akmal and recently I am trying to use FIMEX to read GRIB files, but I could not find any explanation about how to install Fimex in C++ and then I have already read FIMEX site. Please help me. I am using Fimex like bellow example. So while I use some function for instance "defaultLogLevel" and then it gaves me this error
Quote:

Error 1 error LNK2019: unresolved external symbol "void __cdecl MetNoFimex::defaultLogLevel(enum MetNoFimex::Logger::LogLevel)" (?defaultLogLevel@MetNoFimex@@YAXW4LogLevel@Logger@1@@Z) referenced in function main

C++
//Boost
#include <boost/version.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/test/unit_test.hpp>
//C++
#include <vector>
#include <fstream>
#include <iostream>
//FIMEX
#include <fimex/GribCDMReader.h>
#include <fimex/NetCDF_CDMWriter.h>
#include <fimex/Null_CDMWriter.h>
#include <fimex/Logger.h>
#include <fimex/Data.h></blockquote>
//Qt
#include <qdebug>
#include <QtCore/QCoreApplication></blockquote> 
using boost::unit_test_framework::test_suite;
using namespace std;
using namespace MetNoFimex;

int main(int argc, char *argv[])
    {
	    QCoreApplication a(argc, argv);
       
        string fileName( "GRIB file" );
        vector< string > gribFiles;
	    gribFiles.push_back( fileName );

        defaultLogLevel( Logger::INFO );
 
       return a.exec();
}
Posted
Updated 17-Nov-15 15:56pm
v3

You've tagged your question with c++/Qt, but what would be more useful is what environment/compiler you are using to build your program - eg

a) *nix with gcc, makefiles
b) Windows with VS2010, IDE
...

So I can only give you a broad answer - which is, unless FIMEX is included source-code wise into your project, you would need to link against a static or dynamic library that represents the FIMEX 'build' - the error you indicate is symptomatic of

a) not linking the correct FIMEX library into your code (or not linking at all)
b) (possibly) using an incorrect function, but Im running with (a) as my first choice

So you need to look at the documentation and/or distribution for FIMEX, identify the library object(s), and link them appropriately depending on what platform/compiler environment you are using
 
Share this answer
 
Comments
Sukerbek 18-Nov-15 1:09am    
I think FIMEX is for Linux
You need to link your application with the FIMEX library. The libraries should have been build during FIMEX installation[^].

Then add the path to the libraries and the library names to the linker command line (which may be also the GCC command line when linking with GCC) or export them to the LDFLAGS environment variable.

The options are -L<path-to-additional-library-directory> and -l<library-name>. Note that the library name must be specified without the leading 'lib' prefix and any extension.

An export example (might not work on your system, check path and library name):
export LDFLAGS='-L/usr/local/lib/fimex -lfimex'


[EDIT]
I overlooked that you are using Qt.
With Qt, open the Qt project file (*.pro) and add the options to the LIBS (just append them at the end of the existing lines separated by a space):
unix: LIBS += -L/usr/local/lib/fimex/
unix: LIBS += -lfimex
 
Share this answer
 
v2
Comments
Sukerbek 18-Nov-15 5:00am    
I understand what are you talking about but how can I make a lib file and I could not find any way to do this because FIMEX is available for linux I think
Jochen Arndt 18-Nov-15 5:06am    
What do you mean with destribut?

Do you mean distributing it together with your application?
This depends on how your application is distributed and on which systems (Linux distribution and version) it is used.

[EDIT]
You can link the FIMEX library statically to your application.
Then omit the library path and specify the full path and name with the -l option:
unix: LIBS += -l/usr/local/lib/fimex/libfimex.a
Sukerbek 18-Nov-15 20:51pm    
Thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900