Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » C2143 and other errors with any example code (Just adding AddressBook.h from examples causes errors)
C2143 and other errors with any example code [message #51164] Tue, 12 February 2019 22:09 Go to next message
DrOldies is currently offline  DrOldies
Messages: 5
Registered: February 2019
Location: iowa
Promising Member
New to U++ (and any GUI framework) and other simple test packages compile and run. My 1st app will be similar to AddressBook examples I've found. However, importing just header code from any of the several AddressBook code examples causes numerous errors. Other answers I found to C2143 appear to be special cases.

Using TheIDE 11873 on Windows 10. I started with the package "ctrlLib application with main window." The follow code is from: "www.ultimatepp.org/examples$AddressBook$en-us.html"

/* AddressBook.lay*/
LAYOUT(AddressBookLayout, 200, 100)
END_LAYOUT

/* AddressBook.h*/
#ifndef _AddressBook_AddressBook_h
#define _AddressBook_AddressBook_h

#include <CtrlLib/CtrlLib.h>
#include <Report/Report.h>

using namespace Upp;

#define LAYOUTFILE <AddressBook/AddressBook.lay>
#include <CtrlCore/lay.h>

class AddressBook : public WithAddressBookLayout<TopWindow> {
WithModifyLayout<ParentCtrl> modify; //Line 18
WithSearchLayout<ParentCtrl> search; //Line 19
FileSel fs;
String filename;

void SetupSearch();
void Add();
void Change();
void Search();
void Open();
void Save();
void SaveAs();
void Print();
void Quit();

typedef AddressBook CLASSNAME;

public:
void Serialize(Stream& s);

AddressBook();
};
#endif


/*main.cpp */

#include "AddressBook.h"

AddressBook::AddressBook()
{
CtrlLayout(*this, "Window title");
}

GUI_APP_MAIN
{
AddressBook().Run();
}
d:\c++\ultimate++ for windows\upp\myapps\addressbook\AddressBook.h (18): error C2143: syntax error: missing ';' before '<'
d:\c++\ultimate++ for windows\upp\myapps\addressbook\AddressBook.h (18): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\c++\ultimate++ for windows\upp\myapps\addressbook\AddressBook.h (18): error C2238: unexpected token(s) preceding ';'
d:\c++\ultimate++ for windows\upp\myapps\addressbook\AddressBook.h (19): error C2143: syntax error: missing ';' before '<'
d:\c++\ultimate++ for windows\upp\myapps\addressbook\AddressBook.h (19): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\c++\ultimate++ for windows\upp\myapps\addressbook\AddressBook.h (19): error C2238: unexpected token(s) preceding ';'
Re: C2143 and other errors with any example code [message #51165 is a reply to message #51164] Wed, 13 February 2019 03:00 Go to previous message
DrOldies is currently offline  DrOldies
Messages: 5
Registered: February 2019
Location: iowa
Promising Member
SOLVED: Several code lines were missing from the .lay file when I cut and pasted the example

Thanks
Previous Topic: Always compiling libraries when creating new project?
Next Topic: Moving folder and TheIDE compiler paths?
Goto Forum:
  


Current Time: Tue Jan 19 10:27:15 CET 2021

Total time taken to generate the page: 0.00780 seconds