Vest / ElectroField

Electro Field image rendered by CUDA
3 stars 2 forks source link

Compiling errors when using the command #1

Open WilliamWangPeng opened 3 years ago

WilliamWangPeng commented 3 years ago

HI dear author,
It's truly a honor to write a letter to you, I'm building your project nowadays and found the error when building as following, I wonder if there is a chance that you know the reason? :)

image

thank you
best regards to you
William

Vest commented 3 years ago

Hello William (@WilliamWangPeng ),

I appreciate that you have found my project. I wrote it many years ago, when I learned CUDA as a hobby. That's why I was young and stupid, and I didn't create a proper makefile for everyone.

The error "undefined reference" occurs, because you have to install the library GLUT on your linux (Ubuntu, yes?). Here are two libraries that I use in my project:

#include <GL/glew.h>
#include <GL/freeglut.h>

Please check, whether your OS has two packages: libglew-dev and freeglut3-dev.

p.s. if it helps you, I used that book to write "hello world" first and then create my sample: https://github.com/CodedK/CUDA-by-Example-source-code-for-the-book-s-examples-

Kind regards, Vest

WilliamWangPeng commented 3 years ago

thank you for your reply, dear @Vest

image

I have these two packages: libglew-dev and freeglut3-dev.
My compiling command is : nvcc man.cu -o main which causes the error.
so what is your command line when compiling

thank you
Best regards
William

Vest commented 3 years ago

I don't have the command line, @WilliamWangPeng If I am not mistaken it should be something like

nvcc main.cu -lGL -lglut -lGLU -lGLEW