NO

Author Topic: Please help 2d plotter!!! T_T  (Read 18053 times)

hellohowru?

  • Guest
Please help 2d plotter!!! T_T
« on: April 29, 2007, 11:29:51 AM »
I dont really know what im doing. Im trying to use the 2d plotter in from http://g2.sourceforge.net. I downloaded it and i used this code in my mainprogram.c:



#include <stdio.h>
#include <math.h>
#include "g2.h"
#include "g2_X11.h"
#define xsize  3
#define ysize  4

int main(){

   const int dev = g2_open_X11(xsize,ysize);

   g2_close(dev);

   return 0;
}

then i added the .h files g2.h & g2_X11.h it compiled but it would not run it keeped on crying about:
POLINK: error: Unresolved external symbol '_g2_open_X11'
POLINK: error: Unresolved external symbol '_g2_close'
POLINk: fatal error: 2 unresolved external(s)

I dont know if im using the program right. I basically copied and pasted the source codes for g2.h and g2_X11.h and saved them into my project. Do i have to extract files or something? I dont know how to do that. I just want to be able to graph in C!!! :-[ Is that so much to ask? Please i will be forever greatfull if some one can help!

fussl

  • Guest
Re: Please help 2d plotter!!! T_T
« Reply #1 on: April 29, 2007, 01:06:33 PM »
looks like, g2 is a external library, you need.

fussl

  • Guest
Re: Please help 2d plotter!!! T_T
« Reply #2 on: May 01, 2007, 07:16:18 AM »
if you are new to c, it might be a job too big, getting the g2 libraray running in pelles-c.

first qou need to learn,
- basic c,
- linking programs,
- using dynamic link librarys in windows,
- whats unix like environments?(cygwin & mingw),
- and so on...

please take a look in our tips & tricks forum section and the faq section. there i found links to manuals and dokumentations.
also give google a chance, please.

at all you will need approx. some weeks to learn all you need.


Madmanguruman

  • Guest
Re: Please help 2d plotter!!! T_T
« Reply #3 on: May 08, 2007, 06:16:56 PM »
You need to first compile the g2 library, either a static (.lib) or dynamic (.dll) version from the sources that you downloaded.

After this, you can start using the library.

Note that if your program is for Windows, I'd follow the scheme outlined in simple_win32.c (i.e. include g2_win32, and don't include anything for X11):

Code: [Select]
#include <stdio.h>
#include <g2.h>
#include <g2_win32.h>

int main()
{
    int d;
    d=g2_open_win32(100, 100, "simple_win32", 0);
    g2_line(d, 10, 10, 90, 90);
    getchar();
    return 0;
}


Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
Re: Please help 2d plotter!!! T_T
« Reply #4 on: July 23, 2007, 11:20:47 AM »
To let the compiler find a definition file (.h) you don't have to include it in the project files, but you have to specify the directory where it is stored. To do this select "project options" from the "project" menu, choose the tab "folders", in the dialog select the type "includes", than press the button "New Folder" and select the folder where is the file "g2.h".
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

hellohowru?

  • Guest
Re: Please help 2d plotter!!! T_T
« Reply #5 on: July 24, 2007, 07:58:32 AM »
Thanks, it complied but now it wont run -_-

It gave me these errors:
POLINK: error: Unresolved external symbol '_g2_open_win32'.
POLINK: error: Unresolved external symbol '_g2_line'.
POLINK: fatal error: 2 unresolved external(s).
*** Error code: 1 ***
Done.

Why does it not run? I dont know what these errors mean.

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
Re: Please help 2d plotter!!! T_T
« Reply #6 on: July 24, 2007, 11:19:48 AM »
If you're building the g2.dll define the symbols WIN32, G2DLL, MAKEDLL (from project menu in the compiler tabs add these symbols in the "define preprocessor symbols" editbox).
If you still have problems post the project file (extension .ppj).
« Last Edit: July 24, 2007, 02:00:36 PM by frankie »
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

hellohowru?

  • Guest
Re: Please help 2d plotter!!! T_T
« Reply #7 on: July 24, 2007, 10:32:06 PM »
well, im still having problems. It still reads the same errors but now theres a bunch of errors poping out when i try compiling the program:

C:\Documents and Settings\Administrator\Desktop\pleasework\g2-0.72\src\g2.h(183): warning #2016: Extended attribute 'dllexport' requires option /Ze; ignored.

I attached my prj:
« Last Edit: July 24, 2007, 11:06:42 PM by hellohowru? »

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
Re: Please help 2d plotter!!! T_T
« Reply #8 on: July 25, 2007, 07:41:59 PM »
I think it's better to give you the working library with two demo's.
I modified original sources to avoid the use of an additional resource library.
I also corrected many ansi C compliance problems in the sources.
Look at the code and project settings and try to understand the corrections.
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

hellohowru?

  • Guest
Re: Please help 2d plotter!!! T_T
« Reply #9 on: July 25, 2007, 10:43:01 PM »
Grrr.... more problems. I cant get the program running. It gives me these errors now:

Error reading from file 'g2.anim.c'.
The system cannot find the file specified

I downloaded your attachment, then i opened the pelles C icon and pressed execute button but it gave me this error. Why does this happen?

Offline DMac

  • Member
  • *
  • Posts: 272
Re: Please help 2d plotter!!! T_T
« Reply #10 on: July 25, 2007, 11:46:47 PM »
Frankies projects are configured to look for stuff where he has Pelles installed.

I fixed it to look to the default locations.

1.  Unzip this into C:\Program Files\PellesC\Projects

2.  build the dll.

3.  put a copy of the dll in the demo folder.

run the demo.

Good luck.

David M.
No one cares how much you know,
until they know how much you care.

hellohowru?

  • Guest
Re: Please help 2d plotter!!! T_T
« Reply #11 on: July 26, 2007, 01:24:13 AM »
i almost got it to work. What do you mean by putting a copy of the dll into the demo folder? Do you mean copying the dll folder and putting it in the demo folders? or is it some other file?

Error message: The application failed to start because dll was not found.

Offline DMac

  • Member
  • *
  • Posts: 272
Re: Please help 2d plotter!!! T_T
« Reply #12 on: July 26, 2007, 01:43:08 AM »
Look in:

"g2_workspace\g2_dll" folder for the file g2_dll.dll.

If you built this project the file should be there.

copy it to the folder:

"g2_workspace\g2demo"

The demo will now be able to find the dll and should run.

regards,

David M.
No one cares how much you know,
until they know how much you care.

hellohowru?

  • Guest
Re: Please help 2d plotter!!! T_T
« Reply #13 on: July 26, 2007, 05:56:45 AM »
I must not be building correctly because i cant find the file. I thought I just needed to open the project and press the build button but I still cant run it or find the file.

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
Re: Please help 2d plotter!!! T_T
« Reply #14 on: July 26, 2007, 11:32:30 AM »
The way the paths are used by the IDE is somewhat annoying I should ask Pelle to modify the behaviour to make projects more portable.
Anyway to let demo work you need that the dll is available, so first of all build the g2_dll project, than you can build the demo's.
To run the demo's is required the presence of the g2_dll.dll in the folder of the executable, so you must copy the library in the directory of the demo's.
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide