Visual studio missing a ; error

Hi guys I installed then built and compiled the FLTK library for gui use so I can follow along with Bjarnes book,

I followed this tutorial https://www.youtube.com/watch?v=0eSOPWQ1n6U

anyway I put the include files in the GL and FL in the 2017/VC/tools/14.12.25827/include folder and the lib files need in 2017/VC/tools/14.12.25827/lib/x86/
and 2017/VC/tools/14.12.25827/lib/x64 allthough I will be only using it when developing 32 bit projects

so I then added a new cpp file to an empty windows project,

I added fltk.lib into the additional dependencies for the linker in the project build settings

here is the dependencies kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(fltk.lib)

I then set the code generation under the c++ tab and runtime library to Multi-threaded DLL (/MD)as instructed

but I am getting a strange errors

Severity Code Description Project File Line Suppression State Error C2146 syntax error: missing ';' before identifier 'hi' Project5 c:\users\user\source\repos\project5\project5\hey.cpp 9
Severity Code Description Project File Line Suppression State Error (active) E0065 expected a ';' Project5 c:\Users\User\source\repos\Project5\Project5\hey.cpp 9
Severity Code Description Project File Line Suppression State Error C3861 'hi': identifier not found Project5 c:\users\user\source\repos\project5\project5\hey.cpp 9

thanks


1
2
3
4
5
6
7
8
9
10
11
12
13


#include <FL/Fl.h>
#include <FL/Fl_Box.h>
#include <FL/Fl_Window.h>


int main(){

	FL_WINDOW wd(23,23,"hey");

	return 0;
}


thanks
Last edited on
FL_WINDOW is a macro defined in Fl_Window.h
#define FL_WINDOW 0xF0

the class declaration is
Fl_Window : public Fl_Group

That error message is very, very unhelpful (certainly not your fault, it's just the evil nature of macros).

try
Fl_Window wd(23,23,"hey");

note: I have no idea how this library works

Last edited on
Hi Ganado thanks for the reply


I tried

1
2
3
4
5
6
7
8
9
10
11
12
13

#include <FL/Fl.h>
#include <FL/Fl_Window.h>


int main() {

	Fl_Window wd(12, 12, "hey");

	return 0;
}



but now I am getting these errors


Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "public: __thiscall Fl_Window::Fl_Window(int,int,char const *)" (??0Fl_Window@@QAE@HHPBD@Z) referenced in function _main Project8 C:\Users\User\source\repos\Project8\Project8\Source.obj 1


Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "public: virtual __thiscall Fl_Window::~Fl_Window(void)" (??1Fl_Window@@UAE@XZ) referenced in function _main Project8 C:\Users\User\source\repos\Project8\Project8\Source.obj 1

Well, at least those are real linker errors now :p But I'm not too familiar with VS .lib setup.

Maybe read this, it might help, but I don't know
https://stackoverflow.com/questions/20946525/installing-and-working-with-fltk-on-visual-studio-2012

odbc32.lib;odbccp32.lib;%(fltk.lib)

I don't know Visual Studio syntax, but that %() looks quite out of place compared to the other .libs.
What happens if you just make it be
<...>;odbccp32.lib;flkt.lib
Last edited on
Really hate how he doesn't have a section of the book explaining how he sets it up. He really doesn't like to hold hands does he haha. I had issues trying to get SDL to work and I basically just deleted the libs and stuff and found another youtube video explaining how to set it up until it finally worked. Also Im stubborn myself so this isnt an option for me but maybe switch to a different IDE ?
Last edited on
I don't know Visual Studio syntax, but that %() looks quite out of place compared to the other .libs.
What happens if you just make it be
<...>;odbccp32.lib;flkt.lib


damn Ganado you are a genius ! :)

that is exactly what the problem was,

Really hate how he doesn't have a section of the book explaining how he sets it up. He really doesn't like to hold hands does he haha.


lol no it's not the very beginner friendly luckily its not my first c++ book
Yea see some videos show you ways that just don't work for you but works for them. Glad you found a fix!
Topic archived. No new replies allowed.