vygr / C-PCB

C++14 PCB autorouter
GNU General Public License v2.0
75 stars 17 forks source link

about extern function of mymath.cpp error #10

Open mayidu opened 2 years ago

mayidu commented 2 years ago

hi, vygr!

I encountered some problems when running the c++ program, I don't know how to solve it, I would like to ask you。

c_pcb.cpp and c_pcb_dsn.cpp could be compiled and got c_pcb.exe and c_pcb_dsn, but c_pcb_view.cpp had some error.

Since I don't know how to add the glfw library to the Makefile, I use the cmakelists file to perform cmake first, then make. the errors are the compiler cannot resolve the related functions in mymath.cpp.

The file content of cmakefilelists is: image

I'm not very good at c++, hope you can help me take a look, thanks! errors about: image

vygr commented 2 years ago

This project is normally compiled and linked by using “make all” not cmake !

Are you following the README.md instructions ?

If your trying to build for Windows I’m not able to assist much as I don’t have Windows and have never build this project for Windows !

If on Mac or Linux you should be able to install glfw via apt-get or brew etc.

On Windows you would probably have to download and install glfw follow whatever instructions they have on that library doc page. And then I guess you have to use the -L or/and -I switches to tell the linker where it is located.

I would think glfw docs would give you the correct linker options in their app build instructions.

—————- Chris Hinsley

On 15 Jul 2022, at 11:08 am, mayidu_lin @.***> wrote:

 hi, vygr!

I encountered some problems when running the c++ program, I don't know how to solve it, I would like to ask you。

c_pcb.cpp and c_pcb_dsn.cpp could be compiled and got c_pcb.exe and c_pcb_dsn, but c_pcb_view.cpp had some error.

Since I don't know how to add the glfw library to the Makefile, I use the cmakelists file to perform cmake first, then make. the errors are the compiler cannot resolve the related functions in mymath.cpp.

The file content of cmakefilelists is:

I'm not very good at c++, hope you can help me take a look, thanks!

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

vygr commented 2 years ago

For the mymath.cpp refs you may just need to include “cmath.h” or

It’s likely a difference in what Windows includes as standard for the sin/cos/floor/ceil etc functions used by mymath.cpp

—————- Chris Hinsley

On 15 Jul 2022, at 11:20 am, Chris Hinsley @.***> wrote:

This project is normally compiled and linked by using “make all” not cmake !

Are you following the README.md instructions ?

If your trying to build for Windows I’m not able to assist much as I don’t have Windows and have never build this project for Windows !

If on Mac or Linux you should be able to install glfw via apt-get or brew etc.

On Windows you would probably have to download and install glfw follow whatever instructions they have on that library doc page. And then I guess you have to use the -L or/and -I switches to tell the linker where it is located.

I would think glfw docs would give you the correct linker options in their app build instructions.

—————- Chris Hinsley

On 15 Jul 2022, at 11:08 am, mayidu_lin @.***> wrote:

 hi, vygr!

I encountered some problems when running the c++ program, I don't know how to solve it, I would like to ask you。

c_pcb.cpp and c_pcb_dsn.cpp could be compiled and got c_pcb.exe and c_pcb_dsn, but c_pcb_view.cpp had some error.

Since I don't know how to add the glfw library to the Makefile, I use the cmakelists file to perform cmake first, then make. the errors are the compiler cannot resolve the related functions in mymath.cpp.

The file content of cmakefilelists is:

I'm not very good at c++, hope you can help me take a look, thanks!

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

vygr commented 2 years ago

Whenever I have a missing include file problem I look up the missing symbol/function on cppreference.com and see which header file they say that function is defined in. And make sure that I have included that header in the source file or on the Linker line.

—————- Chris Hinsley

On 15 Jul 2022, at 11:20 am, Chris Hinsley @.***> wrote:

This project is normally compiled and linked by using “make all” not cmake !

Are you following the README.md instructions ?

If your trying to build for Windows I’m not able to assist much as I don’t have Windows and have never build this project for Windows !

If on Mac or Linux you should be able to install glfw via apt-get or brew etc.

On Windows you would probably have to download and install glfw follow whatever instructions they have on that library doc page. And then I guess you have to use the -L or/and -I switches to tell the linker where it is located.

I would think glfw docs would give you the correct linker options in their app build instructions.

—————- Chris Hinsley

On 15 Jul 2022, at 11:08 am, mayidu_lin @.***> wrote:

 hi, vygr!

I encountered some problems when running the c++ program, I don't know how to solve it, I would like to ask you。

c_pcb.cpp and c_pcb_dsn.cpp could be compiled and got c_pcb.exe and c_pcb_dsn, but c_pcb_view.cpp had some error.

Since I don't know how to add the glfw library to the Makefile, I use the cmakelists file to perform cmake first, then make. the errors are the compiler cannot resolve the related functions in mymath.cpp.

The file content of cmakefilelists is:

I'm not very good at c++, hope you can help me take a look, thanks!

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.