Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue building klystrack on Linux #295

Closed
distek opened this issue Aug 25, 2020 · 6 comments · Fixed by kometbomb/klystron#22
Closed

Issue building klystrack on Linux #295

distek opened this issue Aug 25, 2020 · 6 comments · Fixed by kometbomb/klystron#22

Comments

@distek
Copy link

distek commented Aug 25, 2020

Hello,

I found your repo and wanted to give it a try! However, during the build I received this:

/usr/bin/ld: objs.debug/command.o:/home/distek/git-clones/klystrack/klystron/src/gui/menu.h:36: multiple definition of `menu_t'; objs.debug/action.o:/home/distek/git-clones/klystrack/klystron/src/gui/menu.h:36: first defined here

for all of the .o files during linking.

I was able to resolve this by changing the menu_t definition in menu.h to the following:

struct menu_t
{
	int flags;
	const struct menu_t *parent;
	const char * text;
	const struct menu_t *submenu;
	void (*action)(void*, void*, void *);
	void *p1, *p2, *p3;
};

The only change being the removal of menu_t after the struct definition:

} menu_t;

I don't know if this would cause issues on other platforms, so I'm just opening this issue for now. If for no other reason than to help someone else using Linux to be able to build this successfully.

Thank you for what you do.

@fgaz
Copy link
Contributor

fgaz commented Sep 24, 2020

fwiw, I'm on linux too and klystrack builds both with and without the patch

@rofl0r
Copy link
Contributor

rofl0r commented Sep 24, 2020

it's usually a bad idea to declare a global variable from a header that's included from multiple translation units. the right fix would be to declare only the struct type in the header with a reference to an external instance, which then lives in a single TU. but since @fgaz reports that klystrack builds with the patch, the variable menu_t is probably not even used.

@kometbomb
Copy link
Owner

kometbomb commented Sep 24, 2020 via email

@rofl0r
Copy link
Contributor

rofl0r commented Sep 24, 2020

I think it's safe to say that is just a typo and missing the typedef keyword.

in this case it would make sense that @distek files a PR with his patch.

@kometbomb
Copy link
Owner

kometbomb commented Sep 25, 2020 via email

@kometbomb
Copy link
Owner

Merged. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants