Problems with CMake

May 5, 2014 at 1:31am
I'm having trouble with a CMake Script I'm writing. I want to make it easier to change settings and generate a makefile, so I wrote this:

http://pastebin.com/m5JRsuat

it's semi-universal (I say that, because it is supposed to work no matter what, except if you switch operating systems on it), so it should work no matter how many, or of hat kind, of files you have: just changes the settings accordingly.

The problem I'm having with it is this:

Linking CXX executable filesystem_demonstration_program
CMakeFiles/filesystem_demonstration_program.dir/source/iofunctions.cpp.o: In function `output::cls()':
iofunctions.cpp:(.text+0x39f): undefined reference to `cur_term'
iofunctions.cpp:(.text+0x3ba): undefined reference to `setupterm'
iofunctions.cpp:(.text+0x3cd): undefined reference to `tigetstr'
iofunctions.cpp:(.text+0x3d5): undefined reference to `putp'
collect2: error: ld returned 1 exit status


term.h is included in the file which the compiler is throwing the error for, so I am at a complete loss as to why this is happening.
Last edited on May 5, 2014 at 8:06pm
May 5, 2014 at 8:21am
the problem is, you havent linked one or some of the libraries, and these functions are not declared
May 5, 2014 at 5:10pm
I know that, but I can't figure out which ones. Looking at term.h, I can see that the defines for the required functions are equal to nothing (as opposed to somthing, under another abstracted condition).

I can't figure out what it is that is causeing this.
May 5, 2014 at 9:55pm
I can see that the defines for the required functions are equal to nothing
If that was the case, the linker wouldn't be able to know that those functions were used, since the preprocessor would have eliminated those strings from the source.
May 6, 2014 at 3:38am
no, the problem was that I was modifying the CMAKE_CXX_FLAGS variable instead of using add_definitions().
Topic archived. No new replies allowed.