Unresolved Externals in PLplot

Oct 14, 2013 at 7:29pm
Hi!
I'm new with PLplot and Cmake. I've spent hours looking over tutorials, instructions, and posts, but still can't figure this out. I keep getting these three errors:

1>main.obj : error LNK2001: unresolved external symbol "public: thiscall plstream::plstream(void)" (??0plstream@@QAE@XZ)
1>main.obj : error LNK2001: unresolved external symbol "public: void thiscall plstream::init(void)" (?init@plstream@@QAEXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: int __thiscall plstream::parseopts(int ,char const * ,int)" (?parseopts@plstream@@QAEHPAHPAPBDH@Z)

I'm trying to follow the example from http://plplot.sourceforge.net/examples.php?demo=00&lbind=C%2B%2B. Here's part of my code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//Includes
#include "plplot.h"
#include "plstream.h"
#include "plc++demos.h"
 
//Standard constructor (I have it in a class)
plot(int num, const char** word)
{
    //Arrays of values
    PLFLT x[NSIZE_], y[NSIZE_];
 
    //Maximums and minimums
    PLFLT xmin = 0.0, xmax = 1.0, ymin = 0.0, ymax = 100.0;

    //Prepare data to be ploted
    for(int i = 0; i < NSIZE_; i++)
    {
        x[i] = (PLFLT) (i) / (PLFLT) (NSIZE_ - 1);
        y[i] = ymax * x[i]*x[i];
    }

    //Set the PLplot data stream
    pls_ = new plstream();//<--------This causes one of the errors.

    pls_->parseopts(&num, word, PL_PARSE_FULL);//<----This one too.

    pls_->init();//<------------------------------This one as well.
}

//pls_ is a private member variable of type plstream* 


Here's my setup:
-I'm using Microsoft Visual Studio 2012.
-I'm running Windows 7 Enterprise 64-Bit.
-I have linked to the PLplot SVN trunk site, so my PLplot version is the most recent.
-I built PLplot for C++ using the CMake-GUI. I selected "Visual Studio 11" as the project generator. All other options I left at their default values.
-Once I built PLplot with Cmake, I went into visual studio and linked to every PLplot library and include folder I could find.

I find it strange that there aren't any files that end with ".lib" in the PLplot directories (except for COPYING.LIB, but I'm pretty sure that's not what I need). Do I have to manually rename some of the files Cmake made to make them .lib files? Any help with this would be greatly appreciated. Thanks!
Oct 14, 2013 at 7:41pm
Did you provide definitions for those functions?
Oct 14, 2013 at 8:14pm
They're declared in the plstream.h file and their definitions are in plstream.cc.
Last edited on Oct 14, 2013 at 8:32pm
Oct 14, 2013 at 8:34pm
CMake only makes the project files required to build the lib files. You need to open the Visual Studio 11 project file and build everything.
Last edited on Oct 14, 2013 at 8:34pm
Oct 14, 2013 at 8:43pm
Maybe that's where I went wrong. Here's what I did:
I used Cmake and had it output to a file called plplotinstall. I then went to plplotinstall/language_tests/CXX and opened test.sln. I linked the lib and include files, then told the solution "ALL_BUILD" in the solution explorer to build.

What am I supposed to do instead?
Oct 14, 2013 at 8:50pm
When CMake generates the solution files, don't change anything - just rebuild the entire solution, and when it outputs the lib files (and possibly DLLs), go to your actual project and link to the lib files.
Oct 14, 2013 at 9:01pm
I'm kind of new at this (most libraries I've used were pre-built), but where are the lib files supposed to be output to? I built (and re-built) the solution and the compiler says it succeeded. I've searched the entire plplotinstall file for .lib and .DLL files and none exist. Either they're not being created or they're being output to some strange location. I even checked the Cmake source to make sure it's not outputting it there. Any ideas? Thanks for your help so far, btw.
Oct 14, 2013 at 9:05pm
It should actually say in the compilation log where it output the files to. I've never used VC++2011 because it's a rare species, so I can't be of more help.
Oct 18, 2013 at 2:35pm
I got it. Apparently some of my earlier CMake builds didn't make the plplot.sln file like they should have. This time it did, so I built it and it made all the .lib and .dll files. Your instrucitons definately helped. Thanks!
Topic archived. No new replies allowed.